diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 8276fe9..eb47321 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -76,7 +76,7 @@ @@ -88,7 +88,7 @@ diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py index aadb156..7a1fe87 100644 --- a/netforce_clinic/models/cycle_item.py +++ b/netforce_clinic/models/cycle_item.py @@ -49,7 +49,7 @@ class CycleItem(Model): "state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True), 'nurse_total': fields.Integer("Nurses",function="_get_all",function_multi=True), } - + def _get_branch(self,context={}): res=get_model('select.company').get_select() if res: @@ -58,8 +58,10 @@ class CycleItem(Model): def _get_department(self,context={}): res=get_model('select.company').get_select() if res: - return res['department_id'] - + if res.get("department_ids"): + return res['department_ids'][0] + else: + return res['department_id'] _defaults={ 'state': 'draft', diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 143a3d1..549c857 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -55,15 +55,6 @@ class Shop(Model): 'note': fields.Text("Note"), } - def _get_branch(self,context={}): - b_ids=get_model('clinic.branch').search([]) - if b_ids: - return b_ids[0] - - def _get_department(self,context={}): - dpt_ids=get_model('clinic.department').search([]) - if dpt_ids: - return dpt_ids[0] def _get_shop_categs(self,context={}): st=get_model("clinic.setting").browse(1) @@ -114,6 +105,19 @@ class Shop(Model): return num get_model("sequence").increment_number(seq_id,context=context) + def _get_branch(self,context={}): + res=get_model('select.company').get_select() + if res: + return res['branch_id'] + + def _get_department(self,context={}): + res=get_model('select.company').get_select() + if res: + if res.get("department_ids"): + return res['department_ids'][0] + else: + return res['department_id'] + _defaults={ 'number': '/', 'date': lambda *a: time.strftime("%Y-%m-%d"), @@ -183,9 +187,8 @@ class Shop(Model): data=context['data'] contact_id=data['contact_id'] data['patient_id']=None - data['department_id']=None - data['branch_id']=None - print("contact_id ", contact_id) + #data['department_id']=None + #data['branch_id']=None for patient in get_model("clinic.patient").search_browse([['partner_id','=',contact_id]]): dpt=patient.department_id branch=patient.branch_id