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))