[英]How to pass wizard fields ids in sale .order.line for Odoo10
[英]hide lock button on sale order form based on state & condition in odoo10
我正在使用Odoo10社区,并且试图继承销售订单表单并编辑锁定按钮,以使其仅在state = sale和我自己的条件(基于其他字段值('Costum_field','=', 'Value1')
)。
销售模块中的原始代码:
<button name="action_done" type="object" string="Lock" states="sale"
help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver."/>
<field name="state" widget="statusbar" statusbar_visible="draft,sent,sale"/>
这是我的代码:
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//button[@name='action_done']" position="attributes">
<attribute name="states" /> <!-- delete states attribute, it's influencing invisible behaviour -->
<attribute name="invisible">['|' , ('state','!=', 'sale'), ('Costum_field','=', 'Value1')]</attribute>
</xpath>
</field>
现在,无论状态值和我的服装领域如何,按钮都是不可见的
谢谢提前
为了在字段,按钮或其他表单元素上设置条件动态属性,您应该依赖于attrs
字段的属性
<field name="inherit_id" ref="sale.view_order_form" /> <field name="arch" type="xml"> <xpath expr="//button[@name='action_done']" position="attributes"> <attribute name="states" /> <!-- delete states attribute, it's influencing invisible behaviour --> <attribute name="attrs">{'invisible': ['|' , ('state','!=', 'sale'), ('Costum_field','=', 'Value1')]}</attribute> </xpath> </field>
看这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.