Merge branch 'pawan_branch' into 'development'

remove error while project create

See merge request prakash.jain/cor-odoo!72
This commit is contained in:
pawan.sharma 2021-01-12 21:51:19 -08:00
commit 97a21972f7
1 changed files with 10 additions and 9 deletions

View File

@ -136,15 +136,16 @@ class Project(models.Model):
def _compute_consultant_timesheet_hour(self):
for val in self:
self._cr.execute('''SELECT project_id, employee_id, SUM(unit_amount) FROM account_analytic_line where project_id = %(project_id)s
GROUP BY project_id, employee_id''', {'project_id': val._origin.id})
res = self._cr.fetchone()
if res:
val.consultant_timesheet_hrs.create({'project_id': res[0],
'employee_id': res[1],
'timesheet_hour': res[2]})
else:
val.consultant_timesheet_hrs = False
if val._origin.id:
self._cr.execute('''SELECT project_id, employee_id, SUM(unit_amount) FROM account_analytic_line where project_id = %(project_id)s
GROUP BY project_id, employee_id''', {'project_id': val._origin.id})
res = self._cr.fetchone()
if res:
val.consultant_timesheet_hrs.create({'project_id': res[0],
'employee_id': res[1],
'timesheet_hour': res[2]})
else:
val.consultant_timesheet_hrs = False
class ProjectConsultantTimesheetHrs(models.Model):