active dpt and brch
parent
a6e008d0d4
commit
8c14f45d8b
|
@ -2,5 +2,6 @@
|
|||
<field name="string">Branches</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.branch</field>
|
||||
<field name="tabs">[["All",[]],["Archived",[["active","=","False"]]]]</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
<field name="string">Departments</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.department</field>
|
||||
<field name="tabs">[["All",[]],["Archived",[["active","=","False"]]]]</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<field name="code"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="company_id"/>
|
||||
<field name="active"/>
|
||||
<related>
|
||||
<field name="departments"/>
|
||||
</related>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<field name="code"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="pick_out_journal_id"/>
|
||||
<field name="active"/>
|
||||
<field name="branch_id" required="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<related>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue