Skip to Content
Menu
This question has been flagged
4 Replies
6512 Views

Hello,

How To Invisible Field Of sale_order_line From Sale_Order ?

For Example One Field Name XYZ(Char) which is in sale.order.line that  Will Be Hidden When We Checked One Field From Sale_order Named Is_pqr(Boolean).

If Field Is_pqr is True Than The Field From Sale_order_line XYZ(Char)  Will Be Invisible


Thanks

Avatar
Discard

Hi, I am trying to do this in version 14 with fields created with Odoo Studio.

attrs="{'invisible':[('order_id.x_studio_field, '=', "ABC")]}"

attrs="{'invisible':[('parent.x_studio_field, '=', "ABC")]}"

It does not work. Basically I want to make a field invisible in the sales order line depending on a field in the sales order.

Thanks

Best Answer
Please use this attrs="{'column_invisible':[('parent.is_pqr','=',True)]}"


Avatar
Discard
Best Answer

Hello

try this,

in SO line
<field name="XYZ" attrs="{'invisible':[('parent.is_pqr', '=', True)]}"/>
or
<field name="XYZ" attrs="{'invisible':[('parent.is_pqr', '!=', False)]}"/>


Avatar
Discard
Best Answer

Hi, 

class SaleOrder(models.Model):       
    _name = 'sale.order'         
    
    is_pqr = fields.Boolean(string='Is PQR')
class SaleOrderLine(models.Model):       
    _name = 'sale.order.line'         
    
    xyz = fields.Char(string='XYZ')

You have to add Below Code in sale.order.line 'XML' File.

<field name="xyz" attrs="{'invisible':[('order_id.is_pqr','!=',False)]}"/>
Avatar
Discard
Author

Thanks But it is giving me error like this.

Error: QWeb2 - template['ListView.row']: Runtime Error: Error: Unknown field order_id.is_distributor in domain [["order_id.is_distributor","!=",False]]

have you add 'is_distributor' in sol, and which odoo version u have used?

Author

V10 and I Want When I Clicked On is_distributor checkbox(on sale order) as True at that time on Sale order Line commission filed will be Invisible

for that you have to put onchange. attrs not work here.

Best Answer
<field name="XYZattrs="{'invisible':[('Is_pqr','=',True)]}"/>
Or
<field name="XYZattrs="{'invisible':[('order_id.Is_pqr','=',True)]}"/>
Avatar
Discard
Author

Error: QWeb2 - template['ListView.row']: Runtime Error: Error: Unknown field order_id.is_distributor in domain [["order_id.is_distributor","=",true]]

Thanks but its not working, it is giving me error like this.