From 4410c17c2b15dc5cc12b49522fc00f9441b6c680 Mon Sep 17 00:00:00 2001 From: "pawan.sharma" Date: Mon, 29 Nov 2021 15:48:54 +0530 Subject: [PATCH] add default employee for timesheet --- cor_custom/models/analytic.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py index c26816c..e10280b 100755 --- a/cor_custom/models/analytic.py +++ b/cor_custom/models/analytic.py @@ -34,6 +34,13 @@ class AccountAnalyticLine(models.Model): ]) return domain + def default_get(self, field_list): + result = super(AccountAnalyticLine, self).default_get(field_list) + if self.env.user: + result['employee_id'] = self.env['hr.employee'].search([('user_id', '=', self.env.user.id)], limit=1).id + return result + + project_id = fields.Many2one('project.project', 'Project', compute='_compute_project_id', store=True, readonly=False, domain=_domain_project_id)