filter product by category from clinic setting
parent
6d90e41fd4
commit
1c18bb5827
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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"/>
|
||||||
|
|
|
@ -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={
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -3,7 +3,7 @@ from netforce.model import Model, fields
|
||||||
class ShopLine(Model):
|
class ShopLine(Model):
|
||||||
_name="clinic.shop.line"
|
_name="clinic.shop.line"
|
||||||
_string="Shop Line"
|
_string="Shop Line"
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
'shop_id': fields.Many2One('clinic.shop','Shop',required=True,on_delete="cascade"),
|
'shop_id': fields.Many2One('clinic.shop','Shop',required=True,on_delete="cascade"),
|
||||||
'product_id': fields.Many2One('product','Product'),
|
'product_id': fields.Many2One('product','Product'),
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue