From 3335e796529f94a1773324cc08e75ab5630e6a52 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 7 Jan 2015 15:09:17 +0100 Subject: [PATCH] [FIX] stock_acount: an invoice origin can be False Therefore: - we avoid to split an a bool, as this isn't possible - we avoid to concatenate False with strings --- addons/stock_account/stock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index 5d2388374ef..b965f6689d7 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -292,8 +292,9 @@ class stock_picking(osv.osv): invoices[key] = invoice_id else: invoice = invoice_obj.browse(cr, uid, invoices[key], context=context) - if invoice_vals['origin'] not in invoice.origin.split(', '): - invoice.write({'origin': '%s, %s' % (invoice.origin, invoice_vals['origin'],)}) + if not invoice.origin or invoice_vals['origin'] not in invoice.origin.split(', '): + origin = filter(None, [invoice.origin, invoice_vals['origin']]) + invoice.write({'origin': ', '.join(origin)}) invoice_line_vals = move_obj._get_invoice_line_vals(cr, uid, move, partner, inv_type, context=context) invoice_line_vals['invoice_id'] = invoices[key]