active dpt and brch

conv_bal
watcha.h@almacom.co.th 2015-01-19 16:00:01 +07:00
parent a6e008d0d4
commit 8c14f45d8b
7 changed files with 16 additions and 0 deletions

View File

@ -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>

View File

@ -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>

View File

@ -3,6 +3,7 @@
<field name="code"/>
<field name="parent_id"/>
<field name="company_id"/>
<field name="active"/>
<related>
<field name="departments"/>
</related>

View File

@ -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>

View File

@ -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()

View File

@ -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"

View File

@ -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