From 73d6529f0c17bb6c6163a48101acddf074fd23e2 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 20 Feb 2015 12:27:51 +0700 Subject: [PATCH] onchange product loan old membrane type --- netforce_clinic/layouts/clinic_dialyzer_list.xml | 3 ++- netforce_clinic/layouts/clinic_hd_case_dlz_form.xml | 2 +- netforce_clinic/models/dialyzer.py | 2 +- netforce_clinic/models/hd_case_popup_dlz.py | 8 +++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/layouts/clinic_dialyzer_list.xml b/netforce_clinic/layouts/clinic_dialyzer_list.xml index e948238..6e87465 100644 --- a/netforce_clinic/layouts/clinic_dialyzer_list.xml +++ b/netforce_clinic/layouts/clinic_dialyzer_list.xml @@ -5,8 +5,9 @@ + + - diff --git a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml index 765dd8a..83203c1 100644 --- a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml @@ -1,6 +1,6 @@
- + diff --git a/netforce_clinic/models/dialyzer.py b/netforce_clinic/models/dialyzer.py index 7f679bd..16f8a58 100644 --- a/netforce_clinic/models/dialyzer.py +++ b/netforce_clinic/models/dialyzer.py @@ -23,7 +23,7 @@ class Dialyzer(Model): "state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status"), "comments": fields.One2Many("message","related_id","Comments"), "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"), "patient_id": fields.Many2One("clinic.patient","Patient",search=True), "visit_id": fields.Many2One("clinic.visit","Visit",search=True), diff --git a/netforce_clinic/models/hd_case_popup_dlz.py b/netforce_clinic/models/hd_case_popup_dlz.py index 0af5ca0..e4cfb27 100644 --- a/netforce_clinic/models/hd_case_popup_dlz.py +++ b/netforce_clinic/models/hd_case_popup_dlz.py @@ -35,8 +35,14 @@ class HDCasePopupDlz(Model): context['pop_id']=obj.id return hd_case.new_dialyzer(context=context) - def onchnage_product(self,context={}): + def onchange_product(self,context={}): 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 HDCasePopupDlz.register()