improve print labor cost

conv_bal
watcha.h 2015-07-30 09:13:02 +07:00
parent 26a77016f9
commit 872c7421fe
3 changed files with 11 additions and 12 deletions

View File

@ -2,7 +2,7 @@
<field name="date" mode="month" onchange="onchange_date" span="2"/>
<field name="date_from" 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="categ_id" span="2"/>
<field name="level_id" span="2"/>

View File

@ -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={}):

View File

@ -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,
}