diff --git a/netforce_clinic/layouts/clinic_branch_form.xml b/netforce_clinic/layouts/clinic_branch_form.xml index 04fa546..2b82588 100644 --- a/netforce_clinic/layouts/clinic_branch_form.xml +++ b/netforce_clinic/layouts/clinic_branch_form.xml @@ -3,4 +3,7 @@ + + + diff --git a/netforce_clinic/layouts/clinic_department_form.xml b/netforce_clinic/layouts/clinic_department_form.xml index 4556095..087ddfe 100644 --- a/netforce_clinic/layouts/clinic_department_form.xml +++ b/netforce_clinic/layouts/clinic_department_form.xml @@ -5,4 +5,7 @@ + + + diff --git a/netforce_clinic/models/branch.py b/netforce_clinic/models/branch.py index bad47e8..27608de 100644 --- a/netforce_clinic/models/branch.py +++ b/netforce_clinic/models/branch.py @@ -10,6 +10,7 @@ class Branch(Model): "code": fields.Char("Code",required=True,search=True), "parent_id": fields.Many2One("clinic.branch","Parent"), "company_id": fields.Many2One("company","Company"), + 'departments': fields.One2Many("clinic.department","branch_id","Departments"), } _defaults={ diff --git a/netforce_clinic/models/department.py b/netforce_clinic/models/department.py index 8b77e1b..b2596fe 100644 --- a/netforce_clinic/models/department.py +++ b/netforce_clinic/models/department.py @@ -13,6 +13,7 @@ class Department(Model): 'company_id': fields.Many2One("company","Company"), 'branch_id': fields.Many2One("clinic.branch","Branch"), "pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True), + 'patients': fields.One2Many("clinic.patient","department_id","Patients"), } def _get_branch(self,context={}): diff --git a/netforce_clinic/models/gen_visit.py b/netforce_clinic/models/gen_visit.py index 8dc5fff..46d9b2a 100644 --- a/netforce_clinic/models/gen_visit.py +++ b/netforce_clinic/models/gen_visit.py @@ -145,7 +145,7 @@ class GenVisit(Model): 'patient_id': patient_id, 'doctor_id': obj.doctor_id.id or patient.doctor_id.id, 'department_id': patient.department_id.id, - 'branch_id': branch_id, + 'branch_id': patient.branch_id.id or branch_id, 'cycle_id': days[weekday]['cycle_id'], 'time_start': ttime_start, 'time_stop': ttime_stop,