From 8fc70bf7ea2696e4a86cdf3d14d583b91f74ebca Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Mon, 6 Apr 2015 16:40:28 +0700 Subject: [PATCH] show detail --- .../layouts/clinic_report_labor_cost.xml | 1 + netforce_clinic/models/report_labor_cost.py | 5 +++ .../templates/report_labor_cost.hbs | 43 +++++++++++-------- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/netforce_clinic/layouts/clinic_report_labor_cost.xml b/netforce_clinic/layouts/clinic_report_labor_cost.xml index caaf794..089ac06 100644 --- a/netforce_clinic/layouts/clinic_report_labor_cost.xml +++ b/netforce_clinic/layouts/clinic_report_labor_cost.xml @@ -4,4 +4,5 @@ + diff --git a/netforce_clinic/models/report_labor_cost.py b/netforce_clinic/models/report_labor_cost.py index 5dbd2da..7fe6f59 100644 --- a/netforce_clinic/models/report_labor_cost.py +++ b/netforce_clinic/models/report_labor_cost.py @@ -15,6 +15,7 @@ class ReportLaborCost(Model): "date_to": fields.Date("To", required=True), "branch_id": fields.Many2One("clinic.branch","Branch"), "department_id": fields.Many2One("clinic.department","Department"), + 'show_detail': fields.Boolean("Show Detail"), } def _get_date_from(self,context={}): @@ -35,6 +36,7 @@ class ReportLaborCost(Model): 'date': time.strftime("%Y-%m-%d"), 'date_from': date_from, 'date_to': date_to, + 'show_detail': False, } return res @@ -46,6 +48,7 @@ class ReportLaborCost(Model): date_to=defaults['date_to'] branch_id=defaults.get("branch_id") department_id=defaults.get("department_id") + show_detail=defaults['show_detail'] dom=[] if ids: obj=self.browse(ids)[0] @@ -53,6 +56,7 @@ class ReportLaborCost(Model): date_to=obj.date_to branch_id=obj.branch_id.id department_id=obj.department_id.id + show_detail=obj.show_detail dom.append(['date','>=',date_from]) dom.append(['date','<=',date_to]) if branch_id: @@ -124,6 +128,7 @@ class ReportLaborCost(Model): 'total_hdcase': total_hdcase, 'branch_id': branch_id, 'department_id': department_id, + 'show_detail': show_detail, } return data diff --git a/netforce_clinic/templates/report_labor_cost.hbs b/netforce_clinic/templates/report_labor_cost.hbs index a307180..16bdefc 100644 --- a/netforce_clinic/templates/report_labor_cost.hbs +++ b/netforce_clinic/templates/report_labor_cost.hbs @@ -13,28 +13,37 @@ {{#each lines }} - - - {{name}} - - - - {{#each sub_lines}} + {{#if ../show_detail}} - {{name}} + + {{name}} + + + + {{#each sub_lines}} + + {{name}} + + {{view "link" string=qty action="clinic_hd_case" action_options=action_options}} + + + {{/each}} + + + Subtotal + + + {{currency qty}} + + + {{else}} + + {{name}} {{view "link" string=qty action="clinic_hd_case" action_options=action_options}} - {{/each}} - - - Subtotal - - - {{currency qty}} - - + {{/if}} {{/each}}