diff --git a/netforce_clinic/actions/clinic_patient.xml b/netforce_clinic/actions/clinic_patient.xml index d943930..7055051 100644 --- a/netforce_clinic/actions/clinic_patient.xml +++ b/netforce_clinic/actions/clinic_patient.xml @@ -3,10 +3,9 @@ multi_view clinic.patient [ - ["All",[]], + ["All",[["state","=","admit"]]], ["Archived",[["active","=","False"]]], - ["Admit",[["state","=","admit"]]], - ["Dispose",[["state","=","dispose"]]]] + ["Disposed",[["state","=","dispose"]]]] clinic_menu 25 diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 9427e32..3ba1d5d 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -19,6 +19,7 @@ + @@ -77,10 +78,13 @@ - - - - + + + + + + + diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index 7dcf870..03a2d58 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -13,6 +13,5 @@ - diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 365ef12..a63021e 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -118,7 +118,8 @@ class Patient(Model): "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "partner_id": fields.Many2One("partner","Contact"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), - "active":fields.Boolean("Active", search=True), + "active":fields.Boolean("Active"), + "dispose":fields.Boolean("Dispose"), 'note': fields.Text("Note"), 'categ_id': fields.Many2One("clinic.patient.categ","Category"), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), @@ -185,6 +186,8 @@ class Patient(Model): def check_idcard(self,idcard=''): res=True + if idcard=='/': + return True if idcard.isalpha(): res=False elif len(idcard)!=13: @@ -242,6 +245,11 @@ class Patient(Model): super().delete(ids) def write(self,ids,vals,**kw): + if 'dispose' in vals.keys(): + if vals['dispose']: + vals['state']='dispose' + else: + vals['state']='admit' if 'card_no' in vals.keys(): self.check_idcard(vals['card_no']) ctx={} @@ -393,5 +401,8 @@ class Patient(Model): },'flash': 'New Dialyzer successfully', } + def onchange_state(self,ids,context={}): + pass + Patient.register() diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index edec093..c5fe3f8 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -110,6 +110,14 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return + for cpt in get_model("clinic.patient.cycle").search_browse([]): + patient=cpt.patient_id + if patient.state!='admit': + print(patient.name) + cpt.delete() + print("Done!") + return + for pt in get_model("clinic.patient").search_browse([]): pt.write({ 'state': 'admit', diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index efd8f97..f9ca269 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,8 +1,7 @@ todo: - - set patient_id with domain state=='treatment' - - compute labor cost - - update level + - update level -> ok + - set patient_id with domain state=='admit' -> ok convbal -> not yet (wait yui) -> ok but have to update memo