[FIX] base: user partner must be kept global on company switch
Introduced when migrating base to new API with 7eab8e2.
closes #14374
opw-694319
This commit is contained in:
committed by
Nicolas Lempereur
parent
10b730af8a
commit
3ea4fb92b3
@@ -359,7 +359,7 @@ class Users(models.Model):
|
||||
if 'company_id' in values:
|
||||
for user in self:
|
||||
# if partner is global we keep it that way
|
||||
if user.partner_id.company_id.id != values['company_id']:
|
||||
if user.partner_id.company_id and user.partner_id.company_id.id != values['company_id']:
|
||||
user.partner_id.write({'company_id': user.company_id.id})
|
||||
# clear default ir values when company changes
|
||||
self.env['ir.values'].get_defaults_dict.clear_cache(self.env['ir.values'])
|
||||
|
||||
Reference in New Issue
Block a user