diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_overtime.xml b/netforce_clinic/layouts/clinic_report_labor_cost_overtime.xml index 5edf1b6..921033a 100644 --- a/netforce_clinic/layouts/clinic_report_labor_cost_overtime.xml +++ b/netforce_clinic/layouts/clinic_report_labor_cost_overtime.xml @@ -2,7 +2,7 @@ - + diff --git a/netforce_clinic/models/print_labor_cost.py b/netforce_clinic/models/print_labor_cost.py index ecfd740..8d84163 100644 --- a/netforce_clinic/models/print_labor_cost.py +++ b/netforce_clinic/models/print_labor_cost.py @@ -134,11 +134,13 @@ class PrintLaborCost(Model): }) db.commit() + + # generate labor costs + lcname='labor.cost.xlsx' + link='http://localhost:9999/report_export_xls?model=clinic.report.labor.cost&template=report_labor_cost&active_id=%s'%(lc_id) + load_report(lcname,link) - #lcname='labor.cost.xlsx' - #link='http://localhost:9999/report_export_xls?model=clinic.report.labor.cost&template=report_labor_cost&active_id=%s'%(lc_id) - #load_report(lcname,link) - + # generate labor cost summary #sum_name='labor.cost-summary.xlsx' #link='http://localhost:9999/report_export_xls?model=clinic.report.labor.cost.summary&template=report_labor_cost_summary&active_id=%s'%(sum_id) #load_report(sum_name,link) @@ -155,11 +157,7 @@ class PrintLaborCost(Model): {'report_file': 'report_daily','model': 'clinic.report.labor.cost.daily', 'report_id': obj.dl_report_id.id,'field_name': 'dl_report_id'}, {'report_file': 'report_ot','model': 'clinic.report.labor.cost.overtime', 'report_id': obj.ot_report_id.id,'field_name': 'ot_report_id'}, ] - count=0 for line in obj.lines: - if count >= 2: - print("Break!") - break staff=line.staff_id for report_line in report_lines: name=staff.number or staff.name or staff.id @@ -177,6 +175,7 @@ class PrintLaborCost(Model): 'branch_id': obj.branch_id.id, 'department_id': obj.department_id.id, 'staff_id': staff.id, + 'staff_type': staff.type }) report_obj=get_model(report_model).browse(report_id) db.commit() @@ -190,6 +189,7 @@ class PrintLaborCost(Model): 'branch_id': obj.branch_id.id, 'department_id': obj.department_id.id, 'staff_id': staff.id, + 'staff_type': staff.type }) db.commit() @@ -203,7 +203,6 @@ class PrintLaborCost(Model): report_file: fname, }) db.commit() - count+=1 print("Done!") def _get_date_from(self,context={}): diff --git a/netforce_clinic/models/report_labor_cost_overtime.py b/netforce_clinic/models/report_labor_cost_overtime.py index e9b58be..309fc2e 100644 --- a/netforce_clinic/models/report_labor_cost_overtime.py +++ b/netforce_clinic/models/report_labor_cost_overtime.py @@ -14,7 +14,7 @@ class ReportLaborCostOverTime(Model): "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), 'staff_id': fields.Many2One("clinic.staff","Staff"), - "type": fields.Selection([["nurse","Nurse"]],"Type"), + "staff_type": fields.Selection([["nurse","Nurse"]],"Type"), 'branch_id': fields.Many2One("clinic.branch","Branch"), #use for generate 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), #use for generate 'department_id': fields.Many2One("clinic.department","Department"), @@ -39,7 +39,7 @@ class ReportLaborCostOverTime(Model): 'date': lambda *a: time.strftime("%Y-%m-%d"), 'date_from': _get_date_from, 'date_to': _get_date_to, - 'type': 'nurse', + 'staff_type': 'nurse', 'categ_id': _get_helper_categ, }