Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

How to put user group as condition in attrs (XML)

形象
odoo
形象
丢弃
2 答案
0
形象
odoo
最佳答案

Hi,


I Think you should create a new computed field and use it in the invisible attrs.


The computed field should look like :

hide_validate = field.Boolean(compute='_compute_can_see')


The compute method :

def _compute_can_see(self):
for rec in self
rec.hide_validate = not(self.env.user.has_group(the xmlid of your group))

And finally your view, first your need to add the computed field to the view




attrs="{'invisible': [
'|',
,'&', ('x', '=', True),('hide_validate', '=', True),

'&',
('show_validate', '=', False),
('hide_validate', '=', True)
]}"

形象
丢弃
0
形象
odoo
最佳答案

Hi Gustave, 

Thanks a lot for helping. I think I see your approach & will try it soon. Just need to study it a bit since I am fairly new on odoo/XML. 

Thanks again, will surely post my result here. 

形象
丢弃