Skip to Content
Menu
This question has been flagged
1 Reply
1320 Views

I have created a new model in my custom module.
There is a field

state = fields.Selection(
string='Status', readonly=True, default='draft',
selection=[
('draft', 'Draft'),
('open', 'Open'),
('in_payment', 'In payment'),
('paid', 'Paid'),
('cancel', 'Cancelled'),
],
required=False, )


field and functions that change the state depending on how my module works.
I want that when the record goes to the cancel state (when state = cancel) for example the Modify button disappears to prevent the user to modify it
NB: I know the readonly attribute and I don't want to use it


Can someone help me please ?

Avatar
Discard
Best Answer

You can override the write method to raise a warning

The edit button won't go but user will not be able to edit the record

Avatar
Discard