filter product by category from clinic setting
parent
6d90e41fd4
commit
1c18bb5827
|
@ -2,7 +2,8 @@
|
|||
<head>
|
||||
<field name="state"/>
|
||||
<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"/>
|
||||
</button>
|
||||
</head>
|
||||
|
|
|
@ -28,6 +28,17 @@
|
|||
</field>
|
||||
</group>
|
||||
</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">
|
||||
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
|
||||
</tab>
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
<field name="ref" span="2"/>
|
||||
<field name="branch_id" span="2"/>
|
||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||
<field name="shop_categs" invisible="1"/>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<field name="lines" nolabel="1">
|
||||
<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="uom_id"/>
|
||||
<field name="qty" onchange="onchange_line"/>
|
||||
|
|
|
@ -27,6 +27,7 @@ class ClinicSetting(Model):
|
|||
'schd_to': fields.Date("To"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
'shop_categs': fields.Many2Many("product.categ","Categs"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
|
@ -10,6 +10,8 @@ class Shop(Model):
|
|||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
st=get_model("clinic.setting").browse(1)
|
||||
shop_categs=[x.id for x in st.shop_categs]
|
||||
for obj in self.browse(ids):
|
||||
total=0
|
||||
for line in obj.lines:
|
||||
|
@ -17,6 +19,7 @@ class Shop(Model):
|
|||
total+=amt
|
||||
res[obj.id]={
|
||||
'total': total,
|
||||
'shop_categs': shop_categs,
|
||||
}
|
||||
return res
|
||||
|
||||
|
@ -34,6 +37,8 @@ class Shop(Model):
|
|||
"pickings": fields.One2Many("stock.picking","related_id","Pickings"),
|
||||
"invoices": fields.One2Many("account.invoice","related_id","Invoices"),
|
||||
"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={}):
|
||||
|
@ -53,6 +58,7 @@ class Shop(Model):
|
|||
'branch_id': _get_branch,
|
||||
'department_id': _get_department,
|
||||
'state': 'draft',
|
||||
'dom_str': 'EPO',
|
||||
}
|
||||
|
||||
def update_all(self,context={}):
|
||||
|
@ -85,4 +91,5 @@ class Shop(Model):
|
|||
data=self.update_all(context)
|
||||
return data
|
||||
|
||||
|
||||
Shop.register()
|
||||
|
|
|
@ -3,7 +3,7 @@ from netforce.model import Model, fields
|
|||
class ShopLine(Model):
|
||||
_name="clinic.shop.line"
|
||||
_string="Shop Line"
|
||||
|
||||
|
||||
_fields={
|
||||
'shop_id': fields.Many2One('clinic.shop','Shop',required=True,on_delete="cascade"),
|
||||
'product_id': fields.Many2One('product','Product'),
|
||||
|
|
|
@ -2,11 +2,9 @@ todo:
|
|||
- patient
|
||||
- link vascular access to patient profile and copy to hd case after confirm on visit -> ok
|
||||
- can update date from hd case to patient
|
||||
- new shop
|
||||
- require membrane type
|
||||
- hd case
|
||||
- move membrane type to dialyzer
|
||||
- make script to update membran type
|
||||
- move membrane type to dialyzer -> ok
|
||||
- make script to update membran type -> ok
|
||||
- add option
|
||||
- new shop
|
||||
- related to hd case
|
||||
|
|
Loading…
Reference in New Issue