Skip to content

Commit

Permalink
[FIX] sale_margin: margin handle included taxes for sale
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
beledouxdenis committed Dec 12, 2014
1 parent ccd2f68 commit f46fa1d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions addons/sale_margin/sale_margin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ def _product_margin(self, cr, uid, ids, field_name, arg, context=None):
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 = {
Expand Down

0 comments on commit f46fa1d

Please sign in to comment.