Hi,
Need your assistance please.
I have a form where I need to select from a many2one field a user from a certain group, sales group only. Odoo 13
I`ve searched and I`m a newbie in understanding the code a little bit.
Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
Need your assistance please.
I have a form where I need to select from a many2one field a user from a certain group, sales group only. Odoo 13
I`ve searched and I`m a newbie in understanding the code a little bit.
Thank you
Hi,
Try the below code.
class YourModel(models.Model):Here I have given a domain for the many2one_field,that function will check the users is in a particular group using has_group method.
_name = 'your.model'
def _get_many2one_field(self):
users_search = self.env['res.users'].search([])
users = []
for user in users_search:
if user.has_group('your_group'):
users.append(user.id)
return [('id', 'in', users)]
many2one_field = fields.Many2one('res.users',domain=_get_many2one_field)
Regards
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up