[FIX] sale: keep customer reference in grouped invoice (opw 606523)
This commit is contained in:
parent
7a157dd35e
commit
0c4bc1cf72
|
@ -525,14 +525,18 @@ class sale_order(osv.osv):
|
|||
if grouped:
|
||||
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
|
||||
invoice_ref = ''
|
||||
origin_ref = ''
|
||||
for o, l in val:
|
||||
invoice_ref += o.name + '|'
|
||||
invoice_ref += (o.client_order_ref or o.name) + '|'
|
||||
origin_ref += (o.origin or o.name) + '|'
|
||||
self.write(cr, uid, [o.id], {'state': 'progress'})
|
||||
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
|
||||
#remove last '|' in invoice_ref
|
||||
if len(invoice_ref) >= 1:
|
||||
invoice_ref = invoice_ref[:-1]
|
||||
invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
|
||||
if len(origin_ref) >= 1:
|
||||
origin_ref = origin_ref[:-1]
|
||||
invoice.write(cr, uid, [res], {'origin': origin_ref, 'name': invoice_ref})
|
||||
else:
|
||||
for order, il in val:
|
||||
res = self._make_invoice(cr, uid, order, il, context=context)
|
||||
|
|
Loading…
Reference in New Issue