From 4f44c61d8b7147cd3b3638e469cbf5315754edce Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Sun, 31 May 2015 14:31:25 +0700 Subject: [PATCH] improve share location --- netforce_clinic/models/share_location.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/models/share_location.py b/netforce_clinic/models/share_location.py index e240967..dc0e50c 100644 --- a/netforce_clinic/models/share_location.py +++ b/netforce_clinic/models/share_location.py @@ -10,7 +10,7 @@ class ShareLocation(Model): _fields={ 'patient_id': fields.Many2One("clinic.patient","Patient",required=True), - 'location': fields.Char("Location",required=True), + 'location': fields.Char("Location"), "loc_select": fields.Selection([],"Departments"), } @@ -71,6 +71,8 @@ class ShareLocation(Model): uloc=self.get_location_user(patient.id,patient_only=True) new_loc=uloc for loc_code in obj.location.split(","): + if not loc_code: + continue res=get_model('clinic.department').search([['code','=',loc_code]]) if not res: raise Exception("Department code %s not found!"%(loc_code))