← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 741612] Re: Sale_margin break if discount= 100%

 

Hi,

Thanks for the answer, I just fix it.

Regards,

Joël

** Changed in: openobject-addons
       Status: Won't Fix => In Progress

** Changed in: openobject-addons
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/741612

Title:
  Sale_margin break if discount= 100%

Status in OpenERP Modules (addons):
  Fix Released

Bug description:
  Hi,

  Install sale_margin, make a 100% discount, hit tab => float division
  by 0 !!!

  You must compute the margin like this:  ((pv / pa) - 1) * 100  instead
  of (((pv-pa)/pv)*100)

  Thanks to fix... Patch given here:

  === modified file 'sale_margin/object/sale_margin.py'
  --- sale_margin/object/sale_margin.py	2010-06-11 10:23:30 +0000
  +++ sale_margin/object/sale_margin.py	2011-03-24 11:01:32 +0000
  @@ -77,7 +77,7 @@
               pa = (std_price*product_uom_qty)
               margin = round(pv -pa,int(config['price_accuracy']))
               res['value']['margin'] = margin
  -            res['value']['marginpourcent'] = (((pv-pa)/pv)*100)
  +            res['value']['marginpourcent'] = ((pv / pa) - 1) * 100
               res['value']['purchase_price'] = std_price
           return res
   


  Regards,

  Joël



References