Merge lp:~openerp-dev/openobject-addons/trunk-bug-724131-ksa into lp:openobject-addons

Proposed by Kirti Savalia(OpenERP)
Status: Rejected
Rejected by: Rucha (Open ERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-724131-ksa
Merge into: lp:openobject-addons
Diff against target: 29 lines (+9/-3)
1 file modified
purchase/purchase.py (+9/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-724131-ksa
Reviewer Review Type Date Requested Status
Rucha (Open ERP) (community) Disapprove
Review via email: mp+82122@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rucha (Open ERP) (rpa-openerp) wrote :

sorry but its not a right solution,
we already have code that loops all PO lines and calls a function to create invoice line,
you can directly link that invoice line and PO line near that function,
see upcoming merge proposal for this bug,
thanks

review: Disapprove

Unmerged revisions

5659. By Kirti Savalia(OpenERP)

[FIX]:Purchase lines without Invoice Lines Relationship

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'purchase/purchase.py'
2--- purchase/purchase.py 2011-11-13 16:07:32 +0000
3+++ purchase/purchase.py 2011-11-14 11:05:28 +0000
4@@ -352,6 +352,8 @@
5 res = False
6
7 journal_obj = self.pool.get('account.journal')
8+ account_invoice_obj = self.pool.get('account.invoice')
9+ purchase_line_obj = self.pool.get('purchase.order.line')
10 for o in self.browse(cr, uid, ids):
11 il = []
12 todo = []
13@@ -390,9 +392,13 @@
14 'payment_term': o.partner_id.property_payment_term and o.partner_id.property_payment_term.id or False,
15 'company_id': o.company_id.id,
16 }
17- inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
18- self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
19- self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True})
20+ inv_id = account_invoice_obj.create(cr, uid, inv, {'type':'in_invoice'})
21+ account_invoice_obj.button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
22+ lines_data = account_invoice_obj.browse(cr, uid, inv_id)
23+ for order_line in o.order_line:
24+ for invoice_line_id in lines_data.invoice_line:
25+ if invoice_line_id.product_id.id == order_line.product_id.id and invoice_line_id.quantity == order_line.product_qty:
26+ purchase_line_obj.write(cr, uid, [order_line.id], {'invoiced':True, 'invoice_lines': [(4, invoice_line_id.id)]})
27 self.write(cr, uid, [o.id], {'invoice_ids': [(4, inv_id)]})
28 res = inv_id
29 return res

Subscribers

People subscribed via source and target branches

to all changes: