improve share location

conv_bal
watcha.h@almacom.co.th 2015-05-31 14:31:25 +07:00
parent 0c2b6adc27
commit 4f44c61d8b
1 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class ShareLocation(Model):
_fields={ _fields={
'patient_id': fields.Many2One("clinic.patient","Patient",required=True), 'patient_id': fields.Many2One("clinic.patient","Patient",required=True),
'location': fields.Char("Location",required=True), 'location': fields.Char("Location"),
"loc_select": fields.Selection([],"Departments"), "loc_select": fields.Selection([],"Departments"),
} }
@ -71,6 +71,8 @@ class ShareLocation(Model):
uloc=self.get_location_user(patient.id,patient_only=True) uloc=self.get_location_user(patient.id,patient_only=True)
new_loc=uloc new_loc=uloc
for loc_code in obj.location.split(","): for loc_code in obj.location.split(","):
if not loc_code:
continue
res=get_model('clinic.department').search([['code','=',loc_code]]) res=get_model('clinic.department').search([['code','=',loc_code]])
if not res: if not res:
raise Exception("Department code %s not found!"%(loc_code)) raise Exception("Department code %s not found!"%(loc_code))