Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
18348 Lượt xem

I have two modules, first module add a field in sale.order.line using xpath :

<record id="view_order_property_form_view" model="ir.ui.view">
            <field name="name">sale.order.property.form</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                        <xpath expr="/form/sheet/notebook/page[@string='Order Lines']/field[@name='order_line']/tree/field[@name='product_id']" position="after">
                                    <field name="property_id" on_change="onchange_property_id(property_id)" domain="[('state','=','for_sale'),('availability','=','available')]"/>
                        </xpath>
            </field> </record>

I want to modify the domain in field property_id using second module without modifying the first module. Is it possible? If it is possible, how to do it?

Thanks in advance.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can use

<xpath  expr="//field[@name='property_id'] position='attributes'>

     <attribute name='domain'>[YOUR NEW DOMAIN]</attribute>

</xpath>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You just need to inherit view_order_property_form_view in second module and then you need to give xpath for property_id and then by applying position='attributes' in xpath you will be able to change domain on that field.

Thanks,
www.acespritech.com

Ảnh đại diện
Huỷ bỏ
Tác giả

I know about the attributes position, but how to write the xpath expression? <xpath expr="?" position="attributes"> </xpath>

You can apply same xpath. Instead of product_id you just need to define property_id.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
2188
2
thg 5 24
2954
1
thg 2 24
1650
4
thg 9 20
6194
1
thg 8 16
10529