[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
This commit is contained in:
Nicolas Martinelli 2015-08-10 11:14:19 +02:00
parent fb3dd3f0f4
commit f2108e9edd
1 changed files with 7 additions and 1 deletions

View File

@ -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]