Reputation: 71
How to only show selected items from selection to statusbar.
I inherited a view which Selection has only 'draft' and 'sent'. Then I added 'cancel'.
state = fields.Selection([
('draft', 'Draft'),
('sent', 'Sent'),
('cancel', 'Cancelled'),
]
I wanted to only show draft and sent. How to make the cancel invisible? or how can i make selected item statusbar invisible?
Upvotes: 1
Views: 4998
Reputation: 3747
Find the statusbar in the view that you want and replace it with an 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>
Upvotes: 3
Reputation: 1631
try this
<field name="state" widget="statusbar" statusbar_visible="draft,sent"/>
Upvotes: 2