[FIX] base: Changing company_id of a partner with child_ids
Steps to reproduce the bug: - Let's consider a company partner P with company_id = A - Let's consider an other partner C which is a child of P - Change the company_id of P to B Bug: The company_id of C was not changed even if the field company_id of C is in readonly as he has a parent. opw:2179632 closes odoo/odoo#44061 X-original-commit: f41f7dc0f4f2a1682c6f81aba6512306ecf86067 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -515,6 +515,8 @@ class Partner(models.Model):
|
||||
if len(companies) > 1 or company not in companies:
|
||||
raise UserError(
|
||||
("The selected company is not compatible with the companies of the related user(s)"))
|
||||
if partner.child_ids:
|
||||
partner.child_ids.write({'company_id': company.id})
|
||||
result = True
|
||||
# To write in SUPERUSER on field is_company and avoid access rights problems.
|
||||
if 'is_company' in vals and self.user_has_groups('base.group_partner_manager') and not self.env.su:
|
||||
|
||||
Reference in New Issue
Block a user