[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#70086 X-original-commit: b3dc922cb45bdd4c2778bea784b540b1723c8fc1 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -153,7 +153,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
|
||||
|
||||
Reference in New Issue
Block a user