Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma/+merge/136140
Hello,
[FIX]: Fixes this issues when we select that customer in invoice it gives
trace-back
Common Configuration to reproduce this issue:-
=>. Create DB without demo data and create one customer.
=>. Installed Account module and configure sales journal.
=>. Try to create a customer invoice. select that created customer GOT ERROR.
=> Code is forward port from 6.1
Thanks,
Mayur
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma/+merge/136140
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2012-11-21 10:21:37 +0000
+++ account/account_invoice.py 2012-11-26 11:11:26 +0000
@@ -456,32 +456,33 @@
res = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['invoice'])
invoice_addr_id = res['invoice']
p = self.pool.get('res.partner').browse(cr, uid, partner_id)
- if company_id:
- if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
- property_obj = self.pool.get('ir.property')
- rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
- pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
- if not rec_pro_id:
- 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_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!'),
- _('Cannot find a chart of accounts for this company, you should create one.'))
- account_obj = self.pool.get('account.account')
- rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id])
- pay_obj_acc = account_obj.browse(cr, uid, [pay_res_id])
- p.property_account_receivable = rec_obj_acc[0]
- p.property_account_payable = pay_obj_acc[0]
+ if p.property_account_receivable and p.property_account_payable:
+ if company_id:
+ if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
+ property_obj = self.pool.get('ir.property')
+ rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
+ pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
+ if not rec_pro_id:
+ 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_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!'),
+ _('Cannot find a chart of accounts for this company, you should create one.'))
+ account_obj = self.pool.get('account.account')
+ rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id])
+ pay_obj_acc = account_obj.browse(cr, uid, [pay_res_id])
+ p.property_account_receivable = rec_obj_acc[0]
+ p.property_account_payable = pay_obj_acc[0]
- if type in ('out_invoice', 'out_refund'):
- acc_id = p.property_account_receivable.id
- else:
- acc_id = p.property_account_payable.id
+ if type in ('out_invoice', 'out_refund'):
+ acc_id = p.property_account_receivable.id
+ else:
+ acc_id = p.property_account_payable.id
fiscal_position = p.property_account_position and p.property_account_position.id or False
partner_payment_term = p.property_payment_term and p.property_payment_term.id or False
if p.bank_ids:
_______________________________________________
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