[FIX] stock_account: remove traceback introduced by f2108e9

invoice_vals['name'] may not be defined yet.
This commit is contained in:
Nicolas Martinelli 2015-08-13 12:46:22 +02:00
parent ed6d9afecc
commit 8827789ff2
1 changed files with 2 additions and 2 deletions

View File

@ -240,7 +240,7 @@ class stock_picking(osv.osv):
@return: object of the partner to invoice
"""
return picking.partner_id and picking.partner_id.id
def action_invoice_create(self, cr, uid, ids, journal_id, group=False, type='out_invoice', context=None):
""" Creates invoice based on the invoice state selected for picking.
@param journal_id: Id of journal
@ -315,7 +315,7 @@ class stock_picking(osv.osv):
if not invoice.origin or invoice_vals['origin'] not in invoice.origin.split(', '):
invoice_origin = filter(None, [invoice.origin, invoice_vals['origin']])
merge_vals['origin'] = ', '.join(invoice_origin)
if not invoice.name or invoice_vals['name'] not in invoice.name.split(', '):
if invoice_vals.get('name', False) and (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: