In a model's view, I have two buttons like these:
button name="button1" type="object" string="Button1"
button name="button2" type="object" string="Button2"
I want to hide Button2 once Button1 is clicked.
The user doesn't have write permission to that model. So, I can't use button's 'visible' property depending on a field, as the user wouldn't be able to change that field.Odoo15
P.S. In the code above, I had to remove tag brackets because the forum engine didn't accept them!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Even if the user doesn't have the write permission for the model, you can use sudo() to write a boolean field as True and hide the second button.
Hello O.Salah,
you can define boolena field in the model and set attrs for button2.
Please find code in comment.
I Hope this Will help you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
For Example:
custom_field = fields.Boolean('Custom Field')
def button1(self)
self.custom_field = True
<button name="button1" type="object" string="Button 1"/>
<button name="button2" type="object" string="Button 2" attrs="{'invisible': [('custom_field', '=', True)]}"/>
Thanks Baiju kS,
This is exactly what I wanted
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
พ.ค. 25
|
146 | ||
|
0
พ.ค. 25
|
197 | ||
|
1
พ.ค. 25
|
564 | ||
|
4
พ.ค. 25
|
1861 | ||
|
2
พ.ค. 25
|
2027 |