summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2014-12-12 15:39:35 +0100
committerDenis Ledoux <dle@odoo.com>2014-12-12 15:41:37 +0100
commitf46fa1d0263ec6f7dd2e0f6dd5c4b90eca8d299e (patch)
tree5b2d72a8391618224f2406ec6dfc5c3c87987128 /addons
parentccd2f68af02331106d8cff8ccb9c71c1d2be69c2 (diff)
[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.
Diffstat (limited to 'addons')
-rw-r--r--addons/sale_margin/sale_margin.py5
1 files changed, 1 insertions, 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 = {