Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6388 มุมมอง

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"/>
อวตาร
ละทิ้ง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
4250
2
มิ.ย. 16
3171
3
ม.ค. 16
4486
1
มี.ค. 15
2988
1
มี.ค. 15
6147