diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 6e9b61c..7922c1b 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -190,6 +190,9 @@ class Patient(Model): return ptype_id def _get_departments(self,context={}): + res=get_model('select.company').get_select() + if res: + return [res['department_id']] return get_model("clinic.department").search([]) def _get_department(self,context={}): diff --git a/netforce_clinic/models/select_company.py b/netforce_clinic/models/select_company.py index 09a48f8..2a27dea 100644 --- a/netforce_clinic/models/select_company.py +++ b/netforce_clinic/models/select_company.py @@ -70,6 +70,8 @@ class SelectCompany(Model): branch_id=None user=get_model("base.user").browse(user_id) dpt=user.department_id + if not dpt: + return {} department_id=dpt.id branch_id=dpt.branch_id.id return { diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index e371bc5..40001d6 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -186,7 +186,10 @@ class Staff(Model): if b_ids: return b_ids[0] - def _get_dpts(self,context={}): + def _get_departments(self,context={}): + res=get_model('select.company').get_select() + if res: + return [res['department_id']] return get_model("clinic.department").search([]) _defaults={ @@ -197,7 +200,7 @@ class Staff(Model): "number": _get_number, "company_id": lambda *a: get_active_company(), 'branch_id': _get_branch, - 'departments': _get_dpts, + 'departments': _get_departments, } #_key=["name_check","branch_id"] #not working diff --git a/netforce_clinic/readme.txt b/netforce_clinic/readme.txt new file mode 100644 index 0000000..f74baae --- /dev/null +++ b/netforce_clinic/readme.txt @@ -0,0 +1,2 @@ +- location + - staff , patient should be main