Incorrect sequence of calculations in product/pricelist.py price_get_multi

Bug #847609 reported by Graeme Gellatly
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

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

Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :

Hello Graeme Gellatly,

Would you please elaborate more with proper example so I can reproduce the early rounding issue.

Thanks and waiting for your reply.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Graeme Gellatly (gdgellatly) wrote : Re: [Bug 847609] Re: Incorrect sequence of calculations in product/pricelist.py price_get_multi

I've had a closer look, and it is very tricky and somewhat pointless to
worry about given the min and max margin is not really right. The current
order gives the right behaviour if min and max margin aren't used, and given
they are mostly unusable I'll set this as invalid.

On Tue, Sep 13, 2011 at 6:52 PM, Vishal Parmar(Open ERP) <
<email address hidden>> wrote:

> Hello Graeme Gellatly,
>
> Would you please elaborate more with proper example so I can reproduce
> the early rounding issue.
>
> Thanks and waiting for your reply.
>
> ** Changed in: openobject-addons
> Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/847609
>
> Title:
> Incorrect sequence of calculations in product/pricelist.py
> price_get_multi
>
> Status in OpenERP Addons (modules):
> Incomplete
>
> 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
>

Changed in openobject-addons:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.