This question has been flagged

Hi I have a field named 'product_description' I want to display it in the quotation for that I also want that field to be in sale order and invoice as well. 

I have started by inheriting sale.order.line and corresponding view sale.view_order_form

<record model="ir.ui.view" id="view_order_form_inherit1">
<field name="name">view.order.form.inherit1</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/field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="product_description"/>
</xpath>
<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='name']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</field>
</record>

Field appeared right after Product in sale order form.

Similarly for quotation template

<record model="ir.ui.view" id="sale_order_template_view_inherit">
<field name="name">sale.order.template.view.inherit1</field>
<field name="model">sale.order.template</field>
<field name="inherit_id" ref="sale_management.sale_order_template_view_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook[@name='main_book']//tree//field[@name='name']" position="after">
<field name='product_description'/>
</xpath>
<xpath expr="//notebook[@name='main_book']//tree//field[@name='name']" position="attributes">
<attribute name='invisible'>True</attribute>
</xpath>
</field>

But when I am creating quotation and selecting quotation template that product description is not getting fitted in sale order line.


Avatar
Discard
Best Answer

Hi,
Maybe it’s because of the wrong xpath. You can try this:

<xpath expr="//tree/field[@name='name']" position="after">
<field name='product_description'/>
</xpath>
<xpath expr="//tree/field[@name='name']" position="attributes">
<attribute name='invisible'>0</attribute>
</xpath>
Regards


Avatar
Discard