From 091e327db378c62ceab924ad2f678d711e4810f7 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 24 Nov 2015 11:03:36 +0700 Subject: [PATCH] recompute labor cost in case to draft --- netforce_clinic/models/hd_case.py | 4 ++++ netforce_clinic/models/report_labor_cost_summary.py | 1 + 2 files changed, 5 insertions(+) diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 2c9b7c3..6ffdfe8 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -1058,6 +1058,10 @@ class HDCase(Model): def undo(self,ids,context={}): obj=self.browse(ids)[0] + # recompute labor cost + lc=get_model("clinic.labor.cost").search_browse([['cycle_item_id','=',obj.cycle_item_id.id]]) + if lc: + lc.compute() context['is_decrease']=True # in case to draft obj.update_usetime(context=context) diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py index 1bcc0d6..971069c 100644 --- a/netforce_clinic/models/report_labor_cost_summary.py +++ b/netforce_clinic/models/report_labor_cost_summary.py @@ -134,6 +134,7 @@ class ReportLaborCostSummary(Model): dpt=citem.department_id qty=line.qty or 0 total_hdcase+=qty + print("total_hdcase ", total_hdcase) amt=line.amount or 0 staff=line.staff_id categ_name=''