Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6486 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź
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"/>
Awatar
Odrzuć

How did you use record rule to restrict edit access?
pls define the domain

Powiązane posty Odpowiedzi Widoki Czynność
1
mar 15
4378
2
cze 16
3371
3
sty 16
4665
1
mar 15
3099
1
mar 15
6256