From f46fa1d0263ec6f7dd2e0f6dd5c4b90eca8d299e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 12 Dec 2014 15:39:35 +0100 Subject: [PATCH] [FIX] sale_margin: margin handle included taxes for sale Another fix should probably be build for purchase price, but it isn't that easy, we need to know the partner to which the product has been purchased, as taxes are partner/country dependent. Besides, included taxes in purchase prices happen less often. --- addons/sale_margin/sale_margin.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 7c58028658e..96031db1f3c 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -52,10 +52,7 @@ class sale_order_line(osv.osv): for line in self.browse(cr, uid, ids, context=context): res[line.id] = 0 if line.product_id: - if line.purchase_price: - res[line.id] = round((line.price_unit*line.product_uos_qty*(100.0-line.discount)/100.0) -(line.purchase_price*line.product_uos_qty), 2) - else: - res[line.id] = round((line.price_unit*line.product_uos_qty*(100.0-line.discount)/100.0) -(line.product_id.standard_price*line.product_uos_qty), 2) + res[line.id] = round(line.price_subtotal - ((line.purchase_price or line.product_id.standard_price) * line.product_uos_qty), 2) return res _columns = {