filter product by category from clinic setting

conv_bal
watcha.h 2015-01-29 22:56:50 +07:00
parent 6d90e41fd4
commit 1c18bb5827
7 changed files with 26 additions and 7 deletions

View File

@ -2,7 +2,8 @@
<head> <head>
<field name="state"/> <field name="state"/>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,waiting_treatment"/> <item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,in_progress,waiting_treatment"/>
<item string="Shop RD" action="clinic_todo" states="draft,in_progress,waiting_treatment"/>
<item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/> <item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
</button> </button>
</head> </head>

View File

@ -28,6 +28,17 @@
</field> </field>
</group> </group>
</tab> </tab>
<tab string="RD Shop">
<group span="6" columns="1">
<separator string="Filter Product By Category Below"/>
<field name="shop_categs" noadd="1" nolabel="1">
<list>
<field name="code"/>
<field name="name"/>
</list>
</field>
</group>
</tab>
<tab string="Development"> <tab string="Development">
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/> <button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
</tab> </tab>

View File

@ -12,11 +12,12 @@
<field name="ref" span="2"/> <field name="ref" span="2"/>
<field name="branch_id" span="2"/> <field name="branch_id" span="2"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/> <field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
<field name="shop_categs" invisible="1"/>
<tabs> <tabs>
<tab string="General"> <tab string="General">
<field name="lines" nolabel="1"> <field name="lines" nolabel="1">
<list> <list>
<field name="product_id" domain='[["categ_id.code","=","EPO"]]' onchange="onchange_product"/> <field name="product_id" domain='[["categ_id","in",parent.shop_categs]]' onchange="onchange_product"/>
<field name="description"/> <field name="description"/>
<field name="uom_id"/> <field name="uom_id"/>
<field name="qty" onchange="onchange_line"/> <field name="qty" onchange="onchange_line"/>

View File

@ -27,6 +27,7 @@ class ClinicSetting(Model):
'schd_to': fields.Date("To"), 'schd_to': fields.Date("To"),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"), 'branch_id': fields.Many2One("clinic.branch","Branch"),
'shop_categs': fields.Many2Many("product.categ","Categs"),
} }
_defaults={ _defaults={

View File

@ -10,6 +10,8 @@ class Shop(Model):
def _get_all(self,ids,context={}): def _get_all(self,ids,context={}):
res={} res={}
st=get_model("clinic.setting").browse(1)
shop_categs=[x.id for x in st.shop_categs]
for obj in self.browse(ids): for obj in self.browse(ids):
total=0 total=0
for line in obj.lines: for line in obj.lines:
@ -17,6 +19,7 @@ class Shop(Model):
total+=amt total+=amt
res[obj.id]={ res[obj.id]={
'total': total, 'total': total,
'shop_categs': shop_categs,
} }
return res return res
@ -34,6 +37,8 @@ class Shop(Model):
"pickings": fields.One2Many("stock.picking","related_id","Pickings"), "pickings": fields.One2Many("stock.picking","related_id","Pickings"),
"invoices": fields.One2Many("account.invoice","related_id","Invoices"), "invoices": fields.One2Many("account.invoice","related_id","Invoices"),
"payments": fields.One2Many("account.payment","related_id","Payments"), "payments": fields.One2Many("account.payment","related_id","Payments"),
'dom_str': fields.Char("Dom Str"),
'shop_categs': fields.Many2Many("product.categ","Categs",function="_get_all",function_multi=True),
} }
def _get_branch(self,context={}): def _get_branch(self,context={}):
@ -53,6 +58,7 @@ class Shop(Model):
'branch_id': _get_branch, 'branch_id': _get_branch,
'department_id': _get_department, 'department_id': _get_department,
'state': 'draft', 'state': 'draft',
'dom_str': 'EPO',
} }
def update_all(self,context={}): def update_all(self,context={}):
@ -85,4 +91,5 @@ class Shop(Model):
data=self.update_all(context) data=self.update_all(context)
return data return data
Shop.register() Shop.register()

View File

@ -2,11 +2,9 @@ todo:
- patient - patient
- link vascular access to patient profile and copy to hd case after confirm on visit -> ok - link vascular access to patient profile and copy to hd case after confirm on visit -> ok
- can update date from hd case to patient - can update date from hd case to patient
- new shop
- require membrane type
- hd case - hd case
- move membrane type to dialyzer - move membrane type to dialyzer -> ok
- make script to update membran type - make script to update membran type -> ok
- add option - add option
- new shop - new shop
- related to hd case - related to hd case