← Back to team overview

c2c-oerpscenario team mailing list archive

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

 

Hello Joel,

This code is of extra addons branch of stable 5.0 version and this
module has been refined in latest version 6.0. I have tested the
scenario with the latest version's code but the problem did not come and
everything works fine.

This code is part of the extra-addons, which are maintained by the
community, including all the modules created by "OpenERP" or "Tiny", as
none of these are actively developed by our teams anymore.

So if you or anyone from the community would like to work on it, please
mark the bug as "In progress" and assign it to yourself (or ask us or
anyone from OpenERP Drivers to do it for you). In the mean time, I will
mark it as "Won't fix" to indicate that no further progress is expected
at the moment. If you require further assistance with any similar
trouble while updating the module, do not hesitate to ask here or via a
question: https://answers.launchpad.net/openobject-addons

I hope you understand, and perhaps this explanation will be helpful to
you if you start fixing this extra-addon...

Thank you!

PS: For whomever works on fixing this, you probably want to apply/merge your changes in both the 6.0 and trunk branches of extra-addons:
https://code.launchpad.net/~openerp-commiter/openobject-addons/extra-6.0
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-extra-addons

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

-- 
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):
  Won't Fix

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