From e358bea6c9f6fbae7fd7155dea27134803cb5fa9 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 13 Mar 2015 07:01:23 +0700 Subject: [PATCH] combine product code before create GI --- netforce_clinic/fixme.txt | 1 + netforce_clinic/layouts/clinic_patient_form.xml | 5 +++-- netforce_clinic/models/hd_case.py | 7 +++++-- netforce_clinic/models/patient.py | 5 +++++ netforce_clinic/models/setting.py | 11 +++++++++++ netforce_clinic/todo.txt | 5 +++++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/fixme.txt b/netforce_clinic/fixme.txt index e352738..0277b0d 100644 --- a/netforce_clinic/fixme.txt +++ b/netforce_clinic/fixme.txt @@ -12,3 +12,4 @@ force to print table for 1 page ->ok ---- visit --- - check duplicate visit +- run script to take department to patient diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 264c32e..ee5e1be 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -17,8 +17,9 @@ - - + + + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 77b0588..d2f97c7 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -620,13 +620,16 @@ class HDCase(Model): for line in obj.lines: if line.state!='draft': continue - if line.qty < 1: continue prod=line.product_id + # check orginal product + prod_code=prod.code.split("-")[0] + if len(prod_code)>1: + prods=get_model('product').search_browse(['code','=',prod_code]) + prod=prods[0] if prod.type != 'stock': continue - #XXX if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids: continue diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 298d5b3..1e5d11e 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -133,6 +133,7 @@ class Patient(Model): "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), 'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'), 'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walk In"), + 'departments': fields.Many2Many("clinic.department","Departments"), } def _get_number(self,context={}): @@ -171,6 +172,9 @@ class Patient(Model): if b_ids: return b_ids[0] + def _get_dpts(self,context={}): + return get_model("clinic.department").search([]) + _defaults={ #"number": _get_number, "number": "", @@ -182,6 +186,7 @@ class Patient(Model): "active" : True, 'state': 'admit', 'walkin': 'no', + 'departments': _get_dpts, } _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 57cf0c0..d1b45c8 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -137,6 +137,17 @@ class ClinicSetting(Model): print("Only admin!!") return dpt_ids=get_model("clinic.department").search([]) + for pt in get_model("clinic.patient").search_browse([]): + dpt2_ids=set() + for vst in pt.visits: + if vst.department_id: + dpt2_ids.update({(vst.department_id.id, vst.cycle_id.id)}) # get day + print('dpt2_ids ', dpt2_ids) + if not pt.departments: + pt.write({ + #'cycles': [['set',dpt2_ids]], + }) + print('set department for ', pt.name) for st in get_model("clinic.staff").search_browse([]): if not st.departments: st.write({ diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 7105875..4c2594c 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,2 +1,7 @@ +- sickbed -> can not see sickbed because mix patient + - fixme: + - see deparment from sickbed => hd_case => and update department of patient (manymany) +hd case => can not click next page + report cycle item : - sunanna can not see