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

I have added a page to sales orders and added an custom field for bill (many2many)

I need a way to make the field read-only for specific users only admin can add the bill 

This my code



can any one help please

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Esraa Abu Amer,


Hope you are doing well.


write you code like this.


//Code in comment//


Hope this helps!


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari  

อวตาร
ละทิ้ง

Code :

<xpath expr="//field[@name='cover_page']" position="before">
<field name="is_manager" invisible="1"/>
<field name="bill_ids"
attrs="{'readonly':[('is_manager', '=', False)]}"/>
</xpath>

is_manager = fields.Boolean(
compute="_compute_is_manager",
)

def _compute_is_manager(self):
self.is_manager = self.env.user.has_group("sales_team.group_sale_manager")

Related Posts ตอบกลับ มุมมอง กิจกรรม
Make field readonly based on group แก้ไขแล้ว
9
ก.ค. 21
63289
8
พ.ย. 19
7927
3
ส.ค. 24
16108
0
พ.ค. 23
1843
1
มี.ค. 23
2443