Hello,
I've inherited the sale.order to add a new boolean field make_ready, like the following
class SaleOrder(models.Model):
_name = 'sale.order'
_inherit = 'sale.order'
make_ready = fields.Boolean(default=False, index=True)
(I also have a new button (near the confirm) in the sale_order view to change the above boolean field)
Then, I've a new filter element in the quotation tree view to filter the quotations based on the value of the above field
< filter string="Made ready" name="made_ready_quotations" domain="[('make_ready', '=', True),('state','in', ('sent','draft'))]" >
It works well.
Now, I've added a new filed to sale.config.settings to show/hide the above new aditions, like below
class SaleConfigSettings(models.TransientModel):
_inherit = 'sale.config.settings'
make_ready_required = fields.Boolean(default=False, string="Make ready required?")
and to get the value of this field in sale.order, I've added a new compute field like below
show_make_ready = fields.Boolean(default=False, index=True, compute='_show_make_ready')
@api.model def _show_make_ready(self):
return self.env['ir.values'].get_default('sale.config.settings', 'make_ready_required')
------
Now, can I show/hide the initially added search filter based on the value of this show_make_ready field?
Or, is there a better way to achive this?