From 9efa15363196a60d2b14e53fa7edc931a815d6d0 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Mon, 13 Sep 2010 12:37:11 +0530 Subject: [PATCH 1/2] [FIX]:survey list view with print action should have nodestroy in its return dict to avoid closing the client bzr revid: nch@tinyerp.com-20100913070711-o96hpbt2edur22gd --- addons/survey/survey.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 5a080e5bfb4..d1d392c5479 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -125,7 +125,8 @@ class survey(osv.osv): 'type': 'ir.actions.report.xml', 'report_name': 'survey.browse.response', 'datas': datas, - 'context' : context + 'context' : context, + 'nodestroy':True, } else: @@ -135,7 +136,8 @@ class survey(osv.osv): 'type': 'ir.actions.report.xml', 'report_name': 'survey.form', 'datas': datas, - 'context' : context + 'context' : context, + 'nodestroy':True, } return report survey() From 476c000425262c0640ebac9e4fc0faacdf420183 Mon Sep 17 00:00:00 2001 From: "James Jesudason,VRA(OpenERP)" <> Date: Mon, 13 Sep 2010 14:41:57 +0530 Subject: [PATCH 2/2] [FIX][IMP] account: fixed the 'id' reference and improved the field name of 'ir.property' object ('value' into 'value_reference'). lp bug: https://launchpad.net/bugs/620481 fixed bzr revid: vra@tinyerp.com-20100913091157-jhh7a64h2hqrw5bs --- addons/account/invoice.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 773fa55e44d..d5bad2ff0bd 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -397,10 +397,10 @@ class account_invoice(osv.osv): rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) - rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value','res_id']) - pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value','res_id']) - rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False - pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False + rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value_reference','res_id']) + pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value_reference','res_id']) + rec_res_id = rec_line_data and rec_line_data[0].get('value_reference',False) and int(rec_line_data[0]['value_reference'].split(',')[1]) or False + pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False if not rec_res_id and not pay_res_id: raise osv.except_osv(_('Configuration Error !'), _('Can not find account chart for this company, Please Create account.')) @@ -493,10 +493,10 @@ class account_invoice(osv.osv): rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)]) - rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value','res_id']) - pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value','res_id']) - rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False - pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False + rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value_reference','res_id']) + pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value_reference','res_id']) + rec_res_id = rec_line_data and rec_line_data[0].get('value_reference',False) and int(rec_line_data[0]['value_reference'].split(',')[1]) or False + pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False if not rec_res_id and not pay_res_id: raise osv.except_osv(_('Configuration Error !'), _('Can not find account chart for this company, Please Create account.')) @@ -1299,7 +1299,12 @@ class account_invoice_line(osv.osv): else: app_acc_in = in_acc_cate else: - app_acc_in = account_obj.browse(cr, uid, in_pro_id)[0] + # Get the fields from the ir.property record + my_value = property_obj.read(cr,uid,in_pro_id,['name','value_reference','res_id']) + # Parse the value_reference field to get the ID of the account.account record + account_id = int (my_value[0]["value_reference"].split(",")[1]) + # Use the ID of the account.account record in the browse for the account.account record + app_acc_in = account_obj.browse(cr, uid, [account_id])[0] if not exp_pro_id: ex_acc = res.product_tmpl_id.property_account_expense ex_acc_cate = res.categ_id.property_account_expense_categ