From 8ab987d828c44e92760986b9ec839861f87a1399 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 6 May 2015 15:29:07 +0200 Subject: [PATCH] [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 --- addons/stock_account/stock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index d7dcdd5443f..f47a5f8e5f5 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -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]