Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
6350 Weergaven

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?

Avatar
Annuleer
Beste antwoord
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"/>
Avatar
Annuleer

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

Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 15
4216
2
jun. 16
3147
3
jan. 16
4464
1
mrt. 15
2973
1
mrt. 15
6116