From 26bc10486eb58ca0adc850c1f0483aff41d689e7 Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Fri, 24 May 2019 15:08:42 +0000 Subject: [PATCH] [FIX] project: progate company in project on AA creation When allowing timesheet on a project, the project generate an analytic account if not given. When creating that account, the company should be the one of the project (origin document) rather than the one of the current user. Task-1999686 --- addons/project/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 3f64b22eedb..f9a9f53c406 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -408,7 +408,7 @@ class Project(models.Model): def _create_analytic_account_from_values(self, values): analytic_account = self.env['account.analytic.account'].create({ 'name': values.get('name', _('Unknown Analytic Account')), - 'company_id': values.get('company_id', self.env.user.company_id.id), + 'company_id': values.get('company_id') or self.env.company.id, 'partner_id': values.get('partner_id'), 'active': True, })