[FIX] stock_account: set the same unit price for extra moves than for moves linked to SO

When extra moves are created, the unit price of the invoice line for these extra moves is now the
same than the unit price of the moves generated from the SO.

opw-634227
This commit is contained in:
Nicolas Martinelli 2015-05-06 15:29:07 +02:00
parent 2e49fc09ff
commit 8ab987d828
1 changed files with 5 additions and 0 deletions

View File

@ -300,6 +300,7 @@ class stock_picking(osv.osv):
move_obj = self.pool.get('stock.move')
invoices = {}
is_extra_move, extra_move_tax = move_obj._get_moves_taxes(cr, uid, moves, context=context)
product_price_unit = {}
for move in moves:
company = move.company_id
origin = move.picking_id.name
@ -321,6 +322,10 @@ class stock_picking(osv.osv):
invoice_line_vals = move_obj._get_invoice_line_vals(cr, uid, move, partner, inv_type, context=context)
invoice_line_vals['invoice_id'] = invoices[key]
invoice_line_vals['origin'] = origin
if not is_extra_move[move.id]:
product_price_unit[invoice_line_vals['product_id']] = invoice_line_vals['price_unit']
if is_extra_move[move.id] and invoice_line_vals['product_id'] in product_price_unit:
invoice_line_vals['price_unit'] = product_price_unit[invoice_line_vals['product_id']]
if is_extra_move[move.id] and extra_move_tax[move.picking_id, move.product_id]:
invoice_line_vals['invoice_line_tax_id'] = extra_move_tax[move.picking_id, move.product_id]