onchange product loan old membrane type

conv_bal
watcha.h 2015-02-20 12:27:51 +07:00
parent 7bd6c040ad
commit 73d6529f0c
4 changed files with 11 additions and 4 deletions

View File

@ -5,8 +5,9 @@
<field name="name"/> <field name="name"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="product_id"/>
<field name="membrane_type"/>
<field name="use_time"/> <field name="use_time"/>
<field name="max_use_time"/> <field name="max_use_time"/>
<field name="exp_date"/>
<field name="state"/> <field name="state"/>
</list> </list>

View File

@ -1,6 +1,6 @@
<form model="clinic.hd.case.popup.dlz"> <form model="clinic.hd.case.popup.dlz">
<field name="hd_case_id" invisible="1"/> <field name="hd_case_id" invisible="1"/>
<field name="product_id" domain="[['categ_id.name','=','Dialyzer']]" span="6"/> <field name="product_id" onchange="onchange_product" domain="[['categ_id.name','=','Dialyzer']]" span="6"/>
<field name="dialyzer_type" required="1" span="6"/> <field name="dialyzer_type" required="1" span="6"/>
<field name="max_use_time" span="6" required="1"/> <field name="max_use_time" span="6" required="1"/>
<field name="membrane_type" required="1" span="6"/> <field name="membrane_type" required="1" span="6"/>

View File

@ -23,7 +23,7 @@ class Dialyzer(Model):
"state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status"), "state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status"),
"comments": fields.One2Many("message","related_id","Comments"), "comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"), "company_id": fields.Many2One("company","Company"),
'product_id': fields.Many2One("product", "Product",required=True), 'product_id': fields.Many2One("product", "Product",required=True,search=True),
"pickings": fields.One2Many("stock.picking","related_id","Pickings"), "pickings": fields.One2Many("stock.picking","related_id","Pickings"),
"patient_id": fields.Many2One("clinic.patient","Patient",search=True), "patient_id": fields.Many2One("clinic.patient","Patient",search=True),
"visit_id": fields.Many2One("clinic.visit","Visit",search=True), "visit_id": fields.Many2One("clinic.visit","Visit",search=True),

View File

@ -35,8 +35,14 @@ class HDCasePopupDlz(Model):
context['pop_id']=obj.id context['pop_id']=obj.id
return hd_case.new_dialyzer(context=context) return hd_case.new_dialyzer(context=context)
def onchnage_product(self,context={}): def onchange_product(self,context={}):
data=context['data'] data=context['data']
product_id=data['product_id']
for dlz in get_model("clinic.dialyzer").search_browse([]):
prod=dlz.product_id
if prod.id==product_id:
data['membrane_type']=dlz.membrane_type
break
return data return data
HDCasePopupDlz.register() HDCasePopupDlz.register()