From 66a9cf0cea48e92044ef5898e29e451664214e53 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 17 Mar 2015 08:49:03 +0700 Subject: [PATCH] walkin --- netforce_clinic/actions/clinic_patient.xml | 1 + netforce_clinic/layouts/clinic_nation_form.xml | 1 + netforce_clinic/layouts/clinic_nation_list.xml | 1 + netforce_clinic/layouts/clinic_patient_form.xml | 3 +-- netforce_clinic/layouts/clinic_patient_list.xml | 2 +- netforce_clinic/models/nation.py | 4 +++- netforce_clinic/models/patient.py | 9 +++++---- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/netforce_clinic/actions/clinic_patient.xml b/netforce_clinic/actions/clinic_patient.xml index 7055051..e634d5a 100644 --- a/netforce_clinic/actions/clinic_patient.xml +++ b/netforce_clinic/actions/clinic_patient.xml @@ -5,6 +5,7 @@ [ ["All",[["state","=","admit"]]], ["Archived",[["active","=","False"]]], + ["Walkin",[["walkin","=","yes"]]], ["Disposed",[["state","=","dispose"]]]] clinic_menu diff --git a/netforce_clinic/layouts/clinic_nation_form.xml b/netforce_clinic/layouts/clinic_nation_form.xml index 46f3549..ad0417f 100644 --- a/netforce_clinic/layouts/clinic_nation_form.xml +++ b/netforce_clinic/layouts/clinic_nation_form.xml @@ -1,3 +1,4 @@
+ diff --git a/netforce_clinic/layouts/clinic_nation_list.xml b/netforce_clinic/layouts/clinic_nation_list.xml index f82fd67..91a7974 100644 --- a/netforce_clinic/layouts/clinic_nation_list.xml +++ b/netforce_clinic/layouts/clinic_nation_list.xml @@ -1,3 +1,4 @@ + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 4fa913a..d1e9810 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -9,13 +9,12 @@ - + - diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index 1673be0..9342926 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -10,7 +10,7 @@ - + diff --git a/netforce_clinic/models/nation.py b/netforce_clinic/models/nation.py index 33bc4ad..8a97756 100644 --- a/netforce_clinic/models/nation.py +++ b/netforce_clinic/models/nation.py @@ -3,9 +3,11 @@ from netforce.model import Model, fields class Nation(Model): _name="clinic.nation" _string="Nationality" + _key=['code'] _fields={ - "name": fields.Char("Name",required=True,search=True), + "code": fields.Char("Name",required=True,search=True), + "name": fields.Char("Code",search=True), } Nation.register() diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index b374bbf..e2c739f 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -246,8 +246,10 @@ class Patient(Model): _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), _order="reg_date desc" - def check_idcard(self,idcard=''): + def check_idcard(self,card_type,idcard=''): res=True + if card_type!='identification': + return False if idcard=='/': return True if idcard.isalpha(): @@ -259,7 +261,7 @@ class Patient(Model): def create(self, vals,**kw): if 'card_no' in vals.keys(): - self.check_idcard(vals['card_no']) + self.check_idcard(vals.get("card_type",""),vals['card_no']) obj_id=super().create(vals,**kw) self.function_store([obj_id]) obj=self.browse(obj_id) @@ -325,7 +327,7 @@ class Patient(Model): vals['state']='admit' vals['rm_remain_visit']=False if 'card_no' in vals.keys(): - self.check_idcard(vals['card_no']) + self.check_idcard(vals.get("card_type",""),vals['card_no']) ctx={} if 'active' in vals.keys(): if not vals['active']: @@ -491,6 +493,5 @@ class Patient(Model): def onchange_state(self,ids,context={}): pass - Patient.register()