conv_bal
watcha.h 2015-04-24 15:43:08 +07:00
commit bc73ddec5a
3 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,7 @@
<field name="date_to" required="1" span="2"/> <field name="date_to" required="1" span="2"/>
<field name="branch_id" onchange="onchange_branch" span="2"/> <field name="branch_id" onchange="onchange_branch" span="2"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/> <field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
<field name="cycle_id" span="2"/>
<field name="report_type" span="2"/> <field name="report_type" span="2"/>
<field name="show_detail" attrs='{"invisible":[["report_type","!=","detail"]]}'/> <field name="show_detail" attrs='{"invisible":[["report_type","!=","detail"]]}'/>
</form> </form>

View File

@ -134,7 +134,7 @@ class HDCase(Model):
elif categ.code=='DLZ': elif categ.code=='DLZ':
dlz_price+=amt dlz_price+=amt
elif categ.code=='SRV': elif categ.code=='SRV':
dlz_price+=amt srv+=amt
elif categ.code=="LAB": elif categ.code=="LAB":
if reimbursable_ctx: if reimbursable_ctx:
if reimbursable_ctx==line.reimbursable: if reimbursable_ctx==line.reimbursable:

View File

@ -14,6 +14,7 @@ class ReportLaborCost(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),
"branch_id": fields.Many2One("clinic.branch","Branch"), "branch_id": fields.Many2One("clinic.branch","Branch"),
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
"department_id": fields.Many2One("clinic.department","Department"), "department_id": fields.Many2One("clinic.department","Department"),
'report_type': fields.Selection([['cross','Cross'],['detail','Detail']],'Type'), 'report_type': fields.Selection([['cross','Cross'],['detail','Detail']],'Type'),
'show_detail': fields.Boolean("Show Detail"), 'show_detail': fields.Boolean("Show Detail"),
@ -51,6 +52,7 @@ class ReportLaborCost(Model):
date_to=defaults['date_to'] date_to=defaults['date_to']
branch_id=defaults.get("branch_id") branch_id=defaults.get("branch_id")
department_id=defaults.get("department_id") department_id=defaults.get("department_id")
cycle_id=defaults.get("cycle_id")
show_detail=defaults['show_detail'] show_detail=defaults['show_detail']
report_type=defaults['report_type'] report_type=defaults['report_type']
dom=[] dom=[]
@ -62,6 +64,7 @@ class ReportLaborCost(Model):
department_id=obj.department_id.id department_id=obj.department_id.id
show_detail=obj.show_detail show_detail=obj.show_detail
report_type=obj.report_type report_type=obj.report_type
cycle_id=obj.cycle_id.id
dom.append(['date','>=',date_from]) dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to]) dom.append(['date','<=',date_to])
dom.append(['cycle_item_id.state','=', 'validated']) dom.append(['cycle_item_id.state','=', 'validated'])
@ -69,10 +72,13 @@ class ReportLaborCost(Model):
dom.append(['branch_id','=',branch_id]) dom.append(['branch_id','=',branch_id])
if department_id: if department_id:
dom.append(['department_id','=',department_id]) dom.append(['department_id','=',department_id])
if cycle_id:
dom.append(['cycle_id','=',cycle_id])
date=date_from date=date_from
hdcases={} hdcases={}
hdcase_obj=get_model("clinic.hd.case") hdcase_obj=get_model("clinic.hd.case")
dstates=dict(hdcase_obj._fields['state'].selection) dstates=dict(hdcase_obj._fields['state'].selection)
print('dom ', dom)
for hdcase in hdcase_obj.search_browse(dom): for hdcase in hdcase_obj.search_browse(dom):
dpt=hdcase.department_id dpt=hdcase.department_id
state=hdcase.state or '' state=hdcase.state or ''
@ -149,6 +155,8 @@ class ReportLaborCost(Model):
dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id]) dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id])
if department_id: if department_id:
dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id]) dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id])
if cycle_id:
dom.append(['labor_cost_id.cycle_item_id.cycle_id','=',cycle_id])
ddata={} ddata={}
ndata={} ndata={}
ctdata={} ctdata={}