diff --git a/netforce_clinic/actions/clinic_branch.xml b/netforce_clinic/actions/clinic_branch.xml index 9d01a1c..fec7148 100644 --- a/netforce_clinic/actions/clinic_branch.xml +++ b/netforce_clinic/actions/clinic_branch.xml @@ -2,5 +2,6 @@ Branches multi_view clinic.branch + [["All",[]],["Archived",[["active","=","False"]]]] clinic_menu diff --git a/netforce_clinic/actions/clinic_department.xml b/netforce_clinic/actions/clinic_department.xml index e598876..c3e7b40 100644 --- a/netforce_clinic/actions/clinic_department.xml +++ b/netforce_clinic/actions/clinic_department.xml @@ -2,5 +2,6 @@ Departments multi_view clinic.department + [["All",[]],["Archived",[["active","=","False"]]]] clinic_menu diff --git a/netforce_clinic/layouts/clinic_branch_form.xml b/netforce_clinic/layouts/clinic_branch_form.xml index 2b82588..550aad3 100644 --- a/netforce_clinic/layouts/clinic_branch_form.xml +++ b/netforce_clinic/layouts/clinic_branch_form.xml @@ -3,6 +3,7 @@ + diff --git a/netforce_clinic/layouts/clinic_department_form.xml b/netforce_clinic/layouts/clinic_department_form.xml index 817dd10..2fb9510 100644 --- a/netforce_clinic/layouts/clinic_department_form.xml +++ b/netforce_clinic/layouts/clinic_department_form.xml @@ -3,6 +3,7 @@ + diff --git a/netforce_clinic/models/branch.py b/netforce_clinic/models/branch.py index 27608de..bdfbbe4 100644 --- a/netforce_clinic/models/branch.py +++ b/netforce_clinic/models/branch.py @@ -11,10 +11,12 @@ class Branch(Model): "parent_id": fields.Many2One("clinic.branch","Parent"), "company_id": fields.Many2One("company","Company"), 'departments': fields.One2Many("clinic.department","branch_id","Departments"), + 'active': fields.Boolean("Active"), } _defaults={ "company_id": lambda *a: get_active_company(), + 'active': True, } Branch.register() diff --git a/netforce_clinic/models/department.py b/netforce_clinic/models/department.py index 87ed72a..7a5a07b 100644 --- a/netforce_clinic/models/department.py +++ b/netforce_clinic/models/department.py @@ -15,6 +15,7 @@ class Department(Model): "pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True), 'patients': fields.One2Many("clinic.patient","department_id","Patients"), 'staffs': fields.One2Many("clinic.staff","department_id","Staffs"), + 'active': fields.Boolean("Active"), } def _get_branch(self,context={}): @@ -25,6 +26,7 @@ class Department(Model): _defaults={ 'company_id': lambda *a: get_active_company(), 'branch_id': _get_branch, + 'active': True, } _order="name" diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index d05b9e2..1f8aa91 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -91,6 +91,14 @@ class ClinicSetting(Model): return True def run_script(self,ids,context={}): + db=get_connection() + db.execute(""" + update clinic_branch set active=True; + update clinic_department set active=True; + """) + print("Done!") + return + obj=self.browse(ids)[0] ################ update sickbed ############# #sickbed: update department