[FIX] sale_stock: take into account the value of the customer reference on grouped invoice (opw #599716)

bzr revid: mat@openerp.com-20131115134335-qsu8ceyx86zyfj8j
This commit is contained in:
Martin Trigaux 2013-11-15 14:43:35 +01:00
commit 1fe9b19c83
1 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,15 @@ class stock_picking(osv.osv):
return picking.note or picking.sale_id.note
return super(stock_picking, self)._get_comment_invoice(cursor, user, picking)
def _prepare_invoice_group(self, cr, uid, picking, partner, invoice, context=None):
""" Inherit the original function of the 'stock' module in order to override name field
to pass the customer reference form the sales order
"""
invoice_vals = super(stock_picking, self)._prepare_invoice_group(cr, uid, picking, partner, invoice, context)
if picking.sale_id:
invoice_vals['name'] = (invoice.name or '') + ', ' + (picking.sale_id.client_order_ref or '')
return invoice_vals
def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None):
""" Inherit the original function of the 'stock' module in order to override some
values if the picking has been generated by a sales order