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?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
1
mar 15
|
4208 | ||
|
2
giu 16
|
3124 | ||
|
3
gen 16
|
4452 | ||
|
1
mar 15
|
2972 | ||
|
1
mar 15
|
6113 |