From eb21830246a4e91ad79545dd3b17e3ac2b964a4e Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Thu, 7 Jan 2016 21:20:57 +0700 Subject: [PATCH] name of nurse not order --- netforce_clinic/models/report_cycle_item.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index 7582e62..aab3cba 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -19,7 +19,7 @@ class ReportCycleItem(Model): "ptype_id": fields.Many2One("clinic.patient.type","Patient Type"), 'branch_id': fields.Many2One("clinic.branch","Branch"), 'department_id': fields.Many2One("clinic.department","Department"), - 'sort_by': fields.Selection([['hdcase_number','HDCase Number'],['pname','Pateint Name'],['mdc_name','EPO']],'Sort By'), + 'sort_by': fields.Selection([['hdcase_number','HDCase Number'],['pname','Patient Name'],['mdc_name','EPO']],'Sort By'), } def default_get(self,field_names=None,context={},**kw): @@ -277,7 +277,17 @@ class ReportCycleItem(Model): index=len(nlines) date_txt='' cseq_txt='' + nurse_items=[] for cline in clines: + if cline.get('nfirst_name'): + nurse_items.append({ + 'nurse': cline.get('nurse'), + 'nfirst_name': cline.get('nfirst_name'), + 'ctid': cline.get('ctid'), + }) + cline['nurse']='' + cline['nfirst_name']='' + cline['ctid']='' if cline.get('cseq_txt'): date_txt=cline.get('date_txt') cseq_txt=cline.get('cseq_txt') @@ -288,6 +298,13 @@ class ReportCycleItem(Model): no+=1 nlines[index]['date_txt']=date_txt nlines[index]['cseq_txt']=cseq_txt + for nurse_item in sorted(nurse_items,key=lambda nitem: nitem['nfirst_name']): + nlines[index].update({ + 'nurse': nurse_item['nurse'], + 'nfirst_name': nurse_item['nfirst_name'], + 'ctid': nurse_item['ctid'], + }) + index+=1 clines=[] nlines.append({ 'sub': 'show',