From 6f6d86792f1919ba80703ef25e7618bc3a15c418 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 24 Nov 2014 17:22:21 +0700 Subject: [PATCH] filter --- .../layouts/clinic_report_nurse_fee_detail.xml | 1 + netforce_clinic/models/report_nurse_fee_detail.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/netforce_clinic/layouts/clinic_report_nurse_fee_detail.xml b/netforce_clinic/layouts/clinic_report_nurse_fee_detail.xml index ee97439..24efed2 100644 --- a/netforce_clinic/layouts/clinic_report_nurse_fee_detail.xml +++ b/netforce_clinic/layouts/clinic_report_nurse_fee_detail.xml @@ -3,4 +3,5 @@ + diff --git a/netforce_clinic/models/report_nurse_fee_detail.py b/netforce_clinic/models/report_nurse_fee_detail.py index 042df6f..edc3f4a 100644 --- a/netforce_clinic/models/report_nurse_fee_detail.py +++ b/netforce_clinic/models/report_nurse_fee_detail.py @@ -16,6 +16,7 @@ class ReportNurseFeeDetail(Model): "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), 'personal_id': fields.Many2One("clinic.personal","Personal"), + "type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["personal","Personal"]],"Type"), } def _get_date_from(self,context={}): @@ -47,12 +48,14 @@ class ReportNurseFeeDetail(Model): time_start='%s-%s-01'%(year,str(month).zfill(2)) time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) personal_id=None + personal_type=None if ids: obj=self.browse(ids)[0] month=obj.date_from.split("-")[1] time_start=obj.date_from time_stop=obj.date_to personal_id=obj.personal_id.id + personal_type=obj.type # new patient of this month dom=[] dom.append(['date','>=',time_start]) @@ -66,11 +69,11 @@ class ReportNurseFeeDetail(Model): # group by date all_vals={} for record in records: - #date='' - #if record.date: - #date=record.date[8:10] date=record.date personal=record.personal_id + if personal_type: + if personal_type!=personal.type: + continue key=(date,personal.id) if key not in all_vals.keys(): all_vals[key]={