如何仅显示从选择到状态栏的所选项目。
我继承了一个视图,其中Selection只有'draft'和'sent'。 然后我添加了'取消'。
state = fields.Selection([
('draft', 'Draft'),
('sent', 'Sent'),
('cancel', 'Cancelled'),
]
我想只显示草稿并发送。如何取消隐形? 或者如何使选定的项状态栏不可见?
答案 0 :(得分:2)
在视图中找到所需的状态栏,并将其替换为xpath:
<record model="ir.ui.view" id="hide_cancel">
<field name="name">Hides cancel button</field>
<field name="model">your.model</field>
<field name="inherit_id" ref="the_view_that_contains_the_statusbar" />
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="replace">
<field name="state" widget="statusbar" statusbar_visible="draft,sent"/>
</xpath>
</field>
</record>
答案 1 :(得分:1)
试试这个
<field name="state" widget="statusbar" statusbar_visible="draft,sent"/>