This question has been flagged
7 Replies
33439 Views

Hello all,

I want hide a field in existing view at sale order form view.

Here i tried is

<xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']" position="attributes">

<attribute name="attrs">{'invisible': 1}</attribute>

</xpath>


Thanks in advance,,,,

Avatar
Discard

Which view did you override with this change?

Best Answer

use the below code...............................



<record id="sale_order_form_b2b" model="ir.ui.view">
<field name="name">sale.order.form.b2b</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_form_inherit" />
<field name="priority">4</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="replace">
<field name="product_id" invisible="1"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':False, 'company_id': parent.company_id}"
groups="base.group_user"
on_change="product_id_change_with_wh(parent.pricelist_id,product_id,product_uom_qty,False,product_uos_qty,False,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, parent.warehouse_id, context)"/>
</xpath>
  </field>
</record>
Avatar
Discard
Author

thanks!

Best Answer

If any of the methods suggested by Tarek or Ray won't work just go to the "Settings/Technical/User Interface/Views"

then search for 'sale.order.form'
click edit and add invisible="1" to the field you want to hide, save and done :)

Avatar
Discard
Best Answer

You have to provide full path of the field you need to hide, try something like the following

<xpath expr="/form/sheet/notebook//page[@string='Products']//field[@name='order_line']/tree//field[@name='product_id']" position="attributes">

    <attribute name="invisible">1</attribute/>

</xpath>

 

Avatar
Discard
Author

not working..!

so, pls give us more information. We need, as Ray pointed out: Which view did you override with this change?