From f9546abf6b4e808845b46a736aa788f26e8d1e22 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 23 Feb 2015 07:50:19 +0700 Subject: [PATCH] show epo on list of hd case --- .../layouts/clinic_hd_case_list.xml | 1 + .../layouts/clinic_patient_form.xml | 4 ++-- netforce_clinic/models/hd_case.py | 18 ++++++++++++++++++ netforce_clinic/models/patient.py | 16 ++++++++++++++++ netforce_clinic/todo.txt | 8 ++++---- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/netforce_clinic/layouts/clinic_hd_case_list.xml b/netforce_clinic/layouts/clinic_hd_case_list.xml index 6db7347..92bb743 100644 --- a/netforce_clinic/layouts/clinic_hd_case_list.xml +++ b/netforce_clinic/layouts/clinic_hd_case_list.xml @@ -4,6 +4,7 @@ + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index d0f91ab..224e390 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -12,10 +12,10 @@ - - + + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 4918e66..cd5b7c9 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -71,8 +71,26 @@ class HDCase(Model): } return res + def _get_epo(self,ids,context={}): + res={} + for obj in self.browse(ids): + names=[] + for line in obj.lines: + prod=line.product_id + categ=line.product_categ_id + if categ and prod: + if categ.code=='EPO': + name=prod.name or "" + name=name.split("-") #XXX + if name: + name=name[0].title() + names.append(name) + res[obj.id]=','.join([n for n in names]) + return res + _fields={ "number": fields.Char("Number",required=True,search=True), + "epo": fields.Char("EPO",function="_get_epo"), 'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'), "ref": fields.Char("Ref",search=True), "time_start": fields.DateTime("Start Time",required=True), diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index aca8c7c..e539076 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -214,8 +214,24 @@ class Patient(Model): if not vals['active']: vals['resign_date']=time.strftime("%Y-%m-%d") vals['rm_remain_visit']=True + else: + vals['rm_remain_visit']=False for obj in self.browse(ids): + if 'department_id' in vals.keys(): + vids=get_model("clinic.visit").search([['patient_id','=',obj.id],['state','in',['draft','pending']]]) + for visit in get_model('clinic.visit').browse(vids): + visit.write({ + 'department_id': vals['department_id'] + }) + print("update visit set department = %s"%(visit.department_id.name)) + if 'branch_id' in vals.keys(): + vids=get_model("clinic.visit").search([['patient_id','=',obj.id],['state','in',['draft','pending']]]) + for visit in get_model('clinic.visit').browse(vids): + visit.write({ + 'branch_id': vals['branch_id'] + }) + print("update visit set branch_id = %s"%(visit.department_id.name)) if 'doctor_id' in vals.keys(): for vs in get_model("clinic.visit").search_browse([['state','in',['draft','pending']],['patient_id','=',obj.id]]): vs.write({ diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 2f31a54..436ce5f 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,5 +1,5 @@ todo: - matching payment - create contact from staff - - xxxx - script to clear invoice + show epo in list of hd case + matching payment > ok + create contact from staff -> ok + script to clear invoice -