İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
2680 Görünümler

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

Avatar
Vazgeç
En İyi Yanıt

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  

Avatar
Vazgeç

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")

İlgili Gönderiler Cevaplar Görünümler Aktivite
9
Tem 21
62931
8
Kas 19
7785
3
Ağu 24
15915
0
May 23
1737
1
Mar 23
2323