Merge lp:~openerp-dev/openobject-addons/7.0-opw-606523-dhr into lp:openobject-addons/7.0

Proposed by Dharti Ratani(OpenERP)
Status: Merged
Merge reported by: Dharti Ratani(OpenERP)
Merged at revision: not available
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-606523-dhr
Merge into: lp:openobject-addons/7.0
Diff against target: 28 lines (+10/-2)
1 file modified
sale/sale.py (+10/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-606523-dhr
Reviewer Review Type Date Requested Status
Vinay Rana (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+216259@code.launchpad.net

Description of the change

Hello Sir,

While creating group invoice of sale orders, set the "Customer Reference" in the invoice as the joint "Customer Reference" of all sale order, if Customer Refernce is present else the name of the sale orders.

To reproduce follow these steps :

1. Create two sales orders to a single customer
2. Input customer reference codes (eg. PO-numbers) to Customer Reference -field in both SOs
3. Go to SO listing view, select the two SOs with check boxes
4. Select Make Invoices from the dropdown
5. Tick Group Invoices
6. Create invoices
Result:
Invoice is correctly created, but Customer Reference field is populated with SO-numbers, separated by the pipe character (|) instead of Customer Reference field contents, as one would expect.

Thanks

To post a comment you must log in.
9992. By Dharti Ratani(OpenERP)

[IMP]Passed the reference of the Source Document from SO to invoice when invoice is created from the wizard Make Invoices after groupng sale orders

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2014-03-25 10:32:26 +0000
3+++ sale/sale.py 2014-05-02 07:07:59 +0000
4@@ -525,14 +525,22 @@
5 if grouped:
6 res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
7 invoice_ref = ''
8+ origin_ref = ''
9 for o, l in val:
10- invoice_ref += o.name + '|'
11+ if o.client_order_ref:
12+ invoice_ref += o.client_order_ref + '|'
13+ else:
14+ invoice_ref += o.name + '|'
15+ if o.origin:
16+ origin_ref += o.origin + '|'
17+ else:
18+ origin_ref += o.name + '|'
19 self.write(cr, uid, [o.id], {'state': 'progress'})
20 cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
21 #remove last '|' in invoice_ref
22 if len(invoice_ref) >= 1:
23 invoice_ref = invoice_ref[:-1]
24- invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
25+ invoice.write(cr, uid, [res], {'origin': origin_ref, 'name': invoice_ref})
26 else:
27 for order, il in val:
28 res = self._make_invoice(cr, uid, order, il, context=context)