diff options
| author | Goffin Simon <sig@odoo.com> | 2021-04-26 12:09:48 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2021-04-29 08:11:58 +0000 |
| commit | 44693ca2689d736849d708aa9bf917db65c4b8a0 (patch) | |
| tree | 6e16ca6ba690499334806081506c1422325b6a47 /addons | |
| parent | 39225827035efe11cdc90b2a7f1ae1f24a54b136 (diff) | |
[FIX] hr_timesheet: Analytic account without company
Steps to reproduce the bug:
- Let's consider a project P set with analytic account AA and company C
- Allow timesheet on P
- Let's consider a task T belonging to P
- Set AA with comapny = False
- Try to encode a timesheet on T
Bug:
A UserError was raised because the field company_id on account.analytic.line is required
opw:2486034
closes odoo/odoo#70071
X-original-commit: b3dc922cb45bdd4c2778bea784b540b1723c8fc1
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_timesheet/models/hr_timesheet.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 17d4a613371..a074961e95f 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -152,7 +152,7 @@ class AccountAnalyticLine(models.Model): if vals.get('project_id') and not vals.get('account_id'): project = self.env['project.project'].browse(vals.get('project_id')) vals['account_id'] = project.analytic_account_id.id - vals['company_id'] = project.analytic_account_id.company_id.id + vals['company_id'] = project.analytic_account_id.company_id.id or project.company_id.id if not project.analytic_account_id.active: raise UserError(_('The project you are timesheeting on is not linked to an active analytic account. Set one on the project configuration.')) # employee implies user |
