I have a two fields on employee.registration model in Odoo 10.
The fields are
require = fields.Boolean(string="Require")
state = fields.Selection([('draft','Draft'),('approval_pending','Sent for Approval'),('approved','Approved'),('approved_finally', 'Approved Finally'),('cancel','Cancel')], default='draft')
I have different states like draft, approval_pending,approved,approved_finally,cancel. If require field equal to true, then cancel option button should be visible in approval_pending and approved state. If require field equal to false, then cancel option button should be visible in approval_pending only.
I tried to invisible the cancel button based on require and state field using attrs,
<button name="cancel_action" type="object" string="Cancel" attrs="{'invisible': ['|', (('require', '=', True), ('state','in', ['draft','approved_finally','refused'])), (('require', '=', False), ('state','in', ['draft','approved','approved_finally','refused']))]}"/>
But its not working. Uncaught Error shown on attrs when I open the record.