[FIX]base: fix domain of "user_id" field in res.partner

Steps to follow to reproduce the bug:
-Go to the Contact app
-Choose any contact
-In the contact form> go to the "sales & purchase" tab and try to assign a user in the "salesperson" fields

Problem:
You can choose any user regardless of their type. While normally we can only choose internal users

Solution:
Add a domain to the "user_id" fields to only see users of the kind "internal type"

opw-2468819

closes odoo/odoo#67642

X-original-commit: 1361686fe502be137a4757c9092fab4223d484f8
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Djamel (otd)
2021-03-11 09:29:51 +00:00
committed by Jorge Pinna Puissant
parent 82e80ee22e
commit a8f8999409
+1 -1
View File
@@ -169,7 +169,7 @@ class Partner(models.Model):
tz_offset = fields.Char(compute='_compute_tz_offset', string='Timezone offset', invisible=True)
user_id = fields.Many2one('res.users', string='Salesperson',
help='The internal user in charge of this contact.')
help='The internal user in charge of this contact.', domain=lambda self: [('groups_id', 'in', self.env.ref('base.group_user').id)])
vat = fields.Char(string='Tax ID', index=True, help="The Tax Identification Number. Complete it if the contact is subjected to government taxes. Used in some legal statements.")
same_vat_partner_id = fields.Many2one('res.partner', string='Partner with same Tax ID', compute='_compute_same_vat_partner_id', store=False)
bank_ids = fields.One2many('res.partner.bank', 'partner_id', string='Banks')