Merge lp:~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma into lp:openobject-addons

Proposed by Mayur Maheshwari(OpenERP)
Status: Rejected
Rejected by: Fabien (Open ERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma
Merge into: lp:openobject-addons
Diff against target: 62 lines (+26/-25)
1 file modified
account/account_invoice.py (+26/-25)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-578572_578611-port-mma
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+136140@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

it should still work for child companies, but your patch does not allow this.

Unmerged revisions

8124. By Amit Dodiya (OpenERP)

[FIX]account: when we select that customer in invoice it gives traceback without demodata datatbase

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2012-11-21 10:21:37 +0000
3+++ account/account_invoice.py 2012-11-26 11:11:26 +0000
4@@ -456,32 +456,33 @@
5 res = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['invoice'])
6 invoice_addr_id = res['invoice']
7 p = self.pool.get('res.partner').browse(cr, uid, partner_id)
8- if company_id:
9- if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
10- property_obj = self.pool.get('ir.property')
11- rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
12- pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
13- if not rec_pro_id:
14- rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
15- if not pay_pro_id:
16- pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)])
17- rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value_reference','res_id'])
18- pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value_reference','res_id'])
19- 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
20- 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
21- if not rec_res_id and not pay_res_id:
22- raise osv.except_osv(_('Configuration Error!'),
23- _('Cannot find a chart of accounts for this company, you should create one.'))
24- account_obj = self.pool.get('account.account')
25- rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id])
26- pay_obj_acc = account_obj.browse(cr, uid, [pay_res_id])
27- p.property_account_receivable = rec_obj_acc[0]
28- p.property_account_payable = pay_obj_acc[0]
29+ if p.property_account_receivable and p.property_account_payable:
30+ if company_id:
31+ if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
32+ property_obj = self.pool.get('ir.property')
33+ rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
34+ pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
35+ if not rec_pro_id:
36+ rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
37+ if not pay_pro_id:
38+ pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)])
39+ rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value_reference','res_id'])
40+ pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value_reference','res_id'])
41+ 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
42+ 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
43+ if not rec_res_id and not pay_res_id:
44+ raise osv.except_osv(_('Configuration Error!'),
45+ _('Cannot find a chart of accounts for this company, you should create one.'))
46+ account_obj = self.pool.get('account.account')
47+ rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id])
48+ pay_obj_acc = account_obj.browse(cr, uid, [pay_res_id])
49+ p.property_account_receivable = rec_obj_acc[0]
50+ p.property_account_payable = pay_obj_acc[0]
51
52- if type in ('out_invoice', 'out_refund'):
53- acc_id = p.property_account_receivable.id
54- else:
55- acc_id = p.property_account_payable.id
56+ if type in ('out_invoice', 'out_refund'):
57+ acc_id = p.property_account_receivable.id
58+ else:
59+ acc_id = p.property_account_payable.id
60 fiscal_position = p.property_account_position and p.property_account_position.id or False
61 partner_payment_term = p.property_payment_term and p.property_payment_term.id or False
62 if p.bank_ids:

Subscribers

People subscribed via source and target branches

to all changes: