[FIX] [sale_stock]: When we create group invoice from delivery order, it is taking customer reference only one which is defined while creating sale order.

bzr revid: cac@openerp.com-20131031054756-qgx2wmyf5o0cs2fp
This commit is contained in:
Chandni Machchhar (OpenERP) 2013-10-31 11:17:56 +05:30
parent f58e4f3f07
commit a5a4a81391
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 picking.note or picking.sale_id.note
return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) 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): 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 """ Inherit the original function of the 'stock' module in order to override some
values if the picking has been generated by a sales order values if the picking has been generated by a sales order