From f2108e9eddcf5fb7b54d13bbe98b947175980f94 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 10 Aug 2015 11:14:19 +0200 Subject: [PATCH] [FIX] stock_account: merge the Reference/Description When invoices are created from pickings, and that the user chooses to group by partner, we make sure to keep the Reference/Description of all the source documents. This is exactly what is done for the Source Document field. opw-646903 --- addons/stock_account/stock.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index ae5a6ebfb49..e24f00afab2 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -311,9 +311,15 @@ class stock_picking(osv.osv): invoices[key] = invoice_id else: invoice = invoice_obj.browse(cr, uid, invoices[key], context=context) + merge_vals = {} if not invoice.origin or invoice_vals['origin'] not in invoice.origin.split(', '): invoice_origin = filter(None, [invoice.origin, invoice_vals['origin']]) - invoice.write({'origin': ', '.join(invoice_origin)}) + merge_vals['origin'] = ', '.join(invoice_origin) + if not invoice.name or invoice_vals['name'] not in invoice.name.split(', '): + invoice_name = filter(None, [invoice.name, invoice_vals['name']]) + merge_vals['name'] = ', '.join(invoice_name) + if merge_vals: + invoice.write(merge_vals) invoice_line_vals = move_obj._get_invoice_line_vals(cr, uid, move, partner, inv_type, context=context) invoice_line_vals['invoice_id'] = invoices[key]