improve print labor cost
parent
26a77016f9
commit
872c7421fe
|
@ -2,7 +2,7 @@
|
||||||
<field name="date" mode="month" onchange="onchange_date" span="2"/>
|
<field name="date" mode="month" onchange="onchange_date" span="2"/>
|
||||||
<field name="date_from" required="1" span="2"/>
|
<field name="date_from" required="1" span="2"/>
|
||||||
<field name="date_to" required="1" span="2"/>
|
<field name="date_to" required="1" span="2"/>
|
||||||
<field name="type" onchange="onchange_type" span="2"/>
|
<field name="staff_type" onchange="onchange_type" span="2"/>
|
||||||
<field name="staff_id" domain='[["type","=",type]]' span="2"/>
|
<field name="staff_id" domain='[["type","=",type]]' span="2"/>
|
||||||
<field name="categ_id" span="2"/>
|
<field name="categ_id" span="2"/>
|
||||||
<field name="level_id" span="2"/>
|
<field name="level_id" span="2"/>
|
||||||
|
|
|
@ -135,10 +135,12 @@ class PrintLaborCost(Model):
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
#lcname='labor.cost.xlsx'
|
# generate labor costs
|
||||||
#link='http://localhost:9999/report_export_xls?model=clinic.report.labor.cost&template=report_labor_cost&active_id=%s'%(lc_id)
|
lcname='labor.cost.xlsx'
|
||||||
#load_report(lcname,link)
|
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'
|
#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)
|
#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)
|
#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_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'},
|
{'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:
|
for line in obj.lines:
|
||||||
if count >= 2:
|
|
||||||
print("Break!")
|
|
||||||
break
|
|
||||||
staff=line.staff_id
|
staff=line.staff_id
|
||||||
for report_line in report_lines:
|
for report_line in report_lines:
|
||||||
name=staff.number or staff.name or staff.id
|
name=staff.number or staff.name or staff.id
|
||||||
|
@ -177,6 +175,7 @@ class PrintLaborCost(Model):
|
||||||
'branch_id': obj.branch_id.id,
|
'branch_id': obj.branch_id.id,
|
||||||
'department_id': obj.department_id.id,
|
'department_id': obj.department_id.id,
|
||||||
'staff_id': staff.id,
|
'staff_id': staff.id,
|
||||||
|
'staff_type': staff.type
|
||||||
})
|
})
|
||||||
report_obj=get_model(report_model).browse(report_id)
|
report_obj=get_model(report_model).browse(report_id)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
@ -190,6 +189,7 @@ class PrintLaborCost(Model):
|
||||||
'branch_id': obj.branch_id.id,
|
'branch_id': obj.branch_id.id,
|
||||||
'department_id': obj.department_id.id,
|
'department_id': obj.department_id.id,
|
||||||
'staff_id': staff.id,
|
'staff_id': staff.id,
|
||||||
|
'staff_type': staff.type
|
||||||
})
|
})
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
@ -203,7 +203,6 @@ class PrintLaborCost(Model):
|
||||||
report_file: fname,
|
report_file: fname,
|
||||||
})
|
})
|
||||||
db.commit()
|
db.commit()
|
||||||
count+=1
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def _get_date_from(self,context={}):
|
def _get_date_from(self,context={}):
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ReportLaborCostOverTime(Model):
|
||||||
"date_from": fields.Date("From", required=True),
|
"date_from": fields.Date("From", required=True),
|
||||||
"date_to": fields.Date("To", required=True),
|
"date_to": fields.Date("To", required=True),
|
||||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
'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
|
'branch_id': fields.Many2One("clinic.branch","Branch"), #use for generate
|
||||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle"), #use for generate
|
'cycle_id': fields.Many2One("clinic.cycle","Cycle"), #use for generate
|
||||||
'department_id': fields.Many2One("clinic.department","Department"),
|
'department_id': fields.Many2One("clinic.department","Department"),
|
||||||
|
@ -39,7 +39,7 @@ class ReportLaborCostOverTime(Model):
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
'date_from': _get_date_from,
|
'date_from': _get_date_from,
|
||||||
'date_to': _get_date_to,
|
'date_to': _get_date_to,
|
||||||
'type': 'nurse',
|
'staff_type': 'nurse',
|
||||||
'categ_id': _get_helper_categ,
|
'categ_id': _get_helper_categ,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue