1

a フィールドが False でない場合、odoo ドメインを適用したいと考えています。

['|',('versions_ids', '=', version_id),(False, '=', version_id)]

私が書いたようなドメインはこのエラーをスローします

TypeError: ハッシュできないタイプ: 'list'

編集:

オブジェクトは次のように拡張します。

class sale_order_line(models.Model):
    _inherit = 'sale.order.line'

    version_id = fields.Many2one('product_cars_application.version',string='Version')

視界が広がる

<record id="sale_cars_append" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="." position="inside">
                    <script type='text/javascript' src='/product_cars_application/static/src/js/filter.js'></script>
                </xpath>

                <xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='product_id']" position="before">
                    <!-- <button name="product_search" type="action" class="oe_highlight" icon="fa-car" /> -->
                    <field name="version_id"/>
                </xpath>
                <xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
                    <attribute name = "domain">['|',('versions_ids', '=', version_id),(False, '=', version_id)]</attribute>
                </xpath>
            </field>
        </record>
4

2 に答える 2

0

これは、このようにする必要があります。

<xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
    <attribute name = "domain">['|',('version_ids', '=', version_id),('version_ids','=',False)]</attribute>
</xpath>

ドメインの別のオプション。

['|',('version_ids', '=', version_id),('version_ids','=',[(6,False,[])])]
于 2016-11-16T04:36:57.800 に答える