跳至內容
選單
此問題已被標幟
1 回覆
6357 瀏覽次數

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

相關帖文 回覆 瀏覽次數 活動
1
3月 15
4220
2
6月 16
3150
3
1月 16
4465
1
3月 15
2976
1
3月 15
6116