[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.
This commit is contained in:
Denis Ledoux 2014-12-12 15:39:35 +01:00
parent ccd2f68af0
commit f46fa1d026
1 changed files with 1 additions and 4 deletions

View File

@ -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 = {