Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-50542-ado into
lp:openobject-addons/6.0.
Requested reviews:
Priyesh (OpenERP) (pso-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50542-ado/+merge/82656
Hello,
[FIX]: Error while fetching income or expense account when you select product
in invoices.
1). Set Any one product with "Can be sold" = True. So only income account is
considered.
2). Remove the income account from the product and from the category of product.
3). Create a new invoice and select the above configured product.
So this will give the "AttributeError: 'bool' object has no attribute 'split'
" Error.
Code is backported from trunk.
This fix the issue.
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50542-ado/+merge/82656
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-50542-ado.
=== modified file 'account/invoice.py'
--- account/invoice.py 2011-10-24 07:25:44 +0000
+++ account/invoice.py 2011-11-18 09:57:25 +0000
@@ -1310,65 +1310,6 @@
result = {}
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
- if company_id:
- property_obj = self.pool.get('ir.property')
- account_obj = self.pool.get('account.account')
- in_pro_id = property_obj.search(cr, uid, [('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
- if not in_pro_id:
- in_pro_id = property_obj.search(cr, uid, [('name','=','property_account_income_categ'),('res_id','=','product.category,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
- exp_pro_id = property_obj.search(cr, uid, [('name','=','property_account_expense'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
- if not exp_pro_id:
- exp_pro_id = property_obj.search(cr, uid, [('name','=','property_account_expense_categ'),('res_id','=','product.category,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
-
- if not in_pro_id:
- in_acc = res.product_tmpl_id.property_account_income
- in_acc_cate = res.categ_id.property_account_income_categ
- if in_acc:
- app_acc_in = in_acc
- else:
- app_acc_in = in_acc_cate
- else:
- # 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, context=context)
- if not exp_pro_id:
- ex_acc = res.product_tmpl_id.property_account_expense
- ex_acc_cate = res.categ_id.property_account_expense_categ
- if ex_acc:
- app_acc_exp = ex_acc
- else:
- app_acc_exp = ex_acc_cate
- else:
- app_acc_exp = account_obj.browse(cr, uid, exp_pro_id, context=context)[0]
- if not in_pro_id and not exp_pro_id:
- in_acc = res.product_tmpl_id.property_account_income
- in_acc_cate = res.categ_id.property_account_income_categ
- ex_acc = res.product_tmpl_id.property_account_expense
- ex_acc_cate = res.categ_id.property_account_expense_categ
- if in_acc or ex_acc:
- app_acc_in = in_acc
- app_acc_exp = ex_acc
- else:
- app_acc_in = in_acc_cate
- app_acc_exp = ex_acc_cate
- if app_acc_in and app_acc_in.company_id.id != company_id and app_acc_exp and app_acc_exp.company_id.id != company_id:
- in_res_id = account_obj.search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)])
- exp_res_id = account_obj.search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
- if not in_res_id and not exp_res_id:
- raise osv.except_osv(_('Configuration Error !'),
- _('Can not find account chart for this company, Please Create account.'))
- in_obj_acc = account_obj.browse(cr, uid, in_res_id, context=context)
- exp_obj_acc = account_obj.browse(cr, uid, exp_res_id, context=context)
- if in_acc or ex_acc:
- res.product_tmpl_id.property_account_income = in_obj_acc[0]
- res.product_tmpl_id.property_account_expense = exp_obj_acc[0]
- else:
- res.categ_id.property_account_income_categ = in_obj_acc[0]
- res.categ_id.property_account_expense_categ = exp_obj_acc[0]
-
if type in ('out_invoice','out_refund'):
a = res.product_tmpl_id.property_account_income.id
if not a:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp