简体   繁体   English

我可以根据Odoo中的销售订单值隐藏销售订单行中的字段列吗?

[英]Can i hide the field's column from Sale order line Based on sale order value In Odoo?

If I tick on boolean field named 'Visible Cost', the labour cost(column) should be hide from sale order line. 如果我在名为“可见成本”的布尔字段上打勾,则人工成本(列)应隐藏在销售订单行中。

Please find dropbox video link. 请找到保管箱视频链接。

https://www.dropbox.com/s/iya26jwy4awfl2f/hide%20field%20in%20sale%20order%20line.ogv?dl=0 https://www.dropbox.com/s/iya26jwy4awfl2f/hide%20field%20in%20sale%20order%20line.ogv?dl=0

Thanks a lot in Advance.... 非常感谢预先...。

You will need to add a related field in the sale.order.line class reflecting the value of the sale.order attribute in each line: 您将需要在sale.order.line类中添加一个相关字段,以反映每行中sale.order属性的值:

 visible_cost = fields.Boolean(related='order_id.visible_cost')

Then extend the corresponding view and add an attrs attribute to the labour cost field in the sale order line. 然后扩展相应的视图,并将attrs属性添加到销售订单行中的人工成本字段。 Note that you have to include the field in the view first (even invisible) to be able to use it in the attrs expression: 请注意,您必须首先在视图中包括该字段(甚至是不可见的),才能在attrs表达式中使用它:

 <field name="visible_cost" invisible="1"/>
 <field name="..labour cost field name..." attrs="{'invisible':visible_cost}"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM