Rem allocated updated

This commit is contained in:
projectsodoo 2021-01-06 21:46:40 +05:30
parent 4901a4948b
commit cdf16a972b
1 changed files with 4 additions and 4 deletions

View File

@ -39,19 +39,19 @@ class PlanningShift(models.Model):
if slot.project_id and slot.employee_id:
if slot.project_id.project_type == 'hours_no_limit':
slot.budgeted_hours = slot.project_id.budgeted_hours
rec = self.search([('project_id','=',slot.project_id.id)])
rec = slot.search([('project_id','=',slot.project_id.id)])
all_hours = 0
for r in rec:
all_hours += r.allocated_hours
slot.rem_all_hours = self.budgeted_hours - all_hours
slot.rem_all_hours = slot.budgeted_hours - all_hours
if slot.project_id.project_type == 'hours_in_consultant':
cons = self.env['project.sale.line.employee.map'].search([('employee_id','=',slot.employee_id.id),('project_id','=',slot.project_id.id)], limit=1)
slot.budgeted_hours = cons and cons.budgeted_qty or 0
rec = self.search([('employee_id', '=', slot.employee_id.id),('project_id', '=', slot.project_id.id)])
rec = slot.search([('employee_id', '=', slot.employee_id.id),('project_id', '=', slot.project_id.id)])
all_hours = 0
for r in rec:
all_hours += r.allocated_hours
slot.rem_all_hours = self.budgeted_hours - all_hours
slot.rem_all_hours = slot.budgeted_hours - all_hours
else:
slot.budgeted_hours = 0
slot.rem_all_hours = 0