[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
This commit is contained in:
Denis Ledoux 2015-01-07 15:09:17 +01:00
parent 31468888a1
commit 3335e79652
1 changed files with 3 additions and 2 deletions

View File

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