← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 847609] [NEW] Incorrect sequence of calculations in product/pricelist.py price_get_multi

 

Public bug reported:

Hi,

I just saw this and noted that it is rounded before calculations on
price have finished meaning either the rounding is entirely unnecessary
and hence a place where errors might come in, or it is happening too
early.  It should happen after the final price is determined.  But also
I think you want to look at that bit of code because it just looks wrong
- if you use the min_margin or max_margin functionality (which I don't)
surely this must be based off a cost price, yet it is calculated using
the just fetched price by the looks of things.

                        if price is not False:
                            price_limit = price

                            price = price * (1.0+(res['price_discount'] or 0.0))
                            price = rounding(price, res['price_round'])
                            price += (res['price_surcharge'] or 0.0)
                            if res['price_min_margin']:
                                price = max(price, price_limit+res['price_min_margin'])
                            if res['price_max_margin']:
                                price = min(price, price_limit+res['price_max_margin'])
                            break

** Affects: openobject-addons
     Importance: Undecided
         Status: New

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

Title:
  Incorrect sequence of calculations in product/pricelist.py
  price_get_multi

Status in OpenERP Addons (modules):
  New

Bug description:
  Hi,

  I just saw this and noted that it is rounded before calculations on
  price have finished meaning either the rounding is entirely
  unnecessary and hence a place where errors might come in, or it is
  happening too early.  It should happen after the final price is
  determined.  But also I think you want to look at that bit of code
  because it just looks wrong - if you use the min_margin or max_margin
  functionality (which I don't) surely this must be based off a cost
  price, yet it is calculated using the just fetched price by the looks
  of things.

                          if price is not False:
                              price_limit = price

                              price = price * (1.0+(res['price_discount'] or 0.0))
                              price = rounding(price, res['price_round'])
                              price += (res['price_surcharge'] or 0.0)
                              if res['price_min_margin']:
                                  price = max(price, price_limit+res['price_min_margin'])
                              if res['price_max_margin']:
                                  price = min(price, price_limit+res['price_max_margin'])
                              break

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/847609/+subscriptions


Follow ups

References