From c513041a32c6d98539358ee3f840a0570df3b285 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Thu, 4 Nov 2010 15:40:19 +0530 Subject: [PATCH] [FIX] SALE: invoice from packing wrong price/unit if product has uos lp bug: https://launchpad.net/bugs/668378 fixed bzr revid: aag@tinyerp.co.in-20101104101019-c219duu0021gjs4h --- addons/sale/stock.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index f9e0c38494b..c020389ba19 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -69,6 +69,13 @@ class stock_picking(osv.osv): def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id: + from_uom_id = move_line.product_id.uom_id.id + to_uom_id = move_line.product_id.uos_id.id + price = move_line.sale_line_id.price_unit + coeff = move_line.product_id.uos_coeff + if from_uom_id != to_uom_id and coeff != 0: + price_unit = price / coeff + return price_unit return move_line.sale_line_id.price_unit return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type)