跳至内容
菜单
此问题已终结
1 回复
3160 查看

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

相关帖文 回复 查看 活动
9
7月 21
63151
8
11月 19
7824
3
8月 24
15998
0
5月 23
1790
1
3月 23
2386