I´ve added a record rule that restricts write when a condition is not met.
The rule works, but the 'Edit' button is not removed. My question is, is the expected behaviour for this button to dissapear if the record is not writeable?
I´ve added a record rule that restricts write when a condition is not met.
The rule works, but the 'Edit' button is not removed. My question is, is the expected behaviour for this button to dissapear if the record is not writeable?
Try this...
# Add Html Field
test_css = fields.Html(string='CSS', sanitize=False, compute='_compute_css', store=False)
# Add compute function@api.depends('state')
def _compute_css(self):
for record in self:
# You can modify the below below condition
if record.state != 'draft':
record.test_css = '<style>.o_form_button_edit {display: none !important;}</style>'
else:
record.test_css = False<!--Finally Add the field in the form view-->
<field name="test_css" invisible="1"/>
It's working
How did you use record rule to restrict edit access?
pls define the domain
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
1
mars 15
|
6225 | |||
|
2
juin 16
|
4996 | |||
|
3
janv. 16
|
6559 | |||
|
1
mars 15
|
4419 | |||
|
1
mars 15
|
8043 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.