[FIX] project: Let be able to remove the company of analytic accounts.
You may want to use an analytic account for several projects of different companies, thus the correct way to proceed should be removing the company of the analytic account. closes odoo/odoo#63172 X-original-commit: f1005e7624e84e6ee7ef467ae3bbccd16c59ce99 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
Nicolas Martinelli
parent
7f7ce72619
commit
c28f0a5bd1
@@ -22,7 +22,7 @@ class AccountAnalyticAccount(models.Model):
|
||||
@api.constrains('company_id')
|
||||
def _check_company_id(self):
|
||||
for record in self:
|
||||
if record.project_ids:
|
||||
if record.company_id and not all(record.company_id == c for c in record.project_ids.mapped('company_id')):
|
||||
raise UserError(_('You cannot change the company of an analytic account if it is related to a project.'))
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
|
||||
Reference in New Issue
Block a user