[trunk] sale analysis - wrong average price

Bug #646350 reported by Ferdinand
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

see png

precision/rounding error ?

Related branches

Revision history for this message
Ferdinand (office-chricar) wrote :
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Changed in openobject-addons:
milestone: none → 6.0-rc2
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello Ferdinand,

Yes, you are absolutely right, its a bug but rather a very logical issue. I have tested it by setting 'group_by_no_leaf' as 0 to be more clear with child records. This happens due to 'group_operator' used for the average price field so currently it will show the average of average price. IMHO, it should show the sum of average price by removing the group_operator attribute.

Your suggestions please...

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I don't see a way to do this.
We do average of prices instead of sum(price*qty)/sum(qty). As it depends on the way you Group By, I don't see a way to do that.
Even if we do Total Price / Total Qty, as it's computed on the detailed level, it will not work.

OpeneRP supports only two attributes on a field aggregation (sum, average). We can not do complex formulae for group_by. We can do an average but not a ponderated average.

Changed in openobject-addons:
status: In Progress → Invalid
Revision history for this message
Ferdinand (office-chricar) wrote :

Seriously I have a problem if OpenERP is showing wrong date
if the correct data can't be calculated it has to be suppressed

Changed in openobject-addons:
status: Invalid → New
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

What if we specified a special group_operator to compute the average price column of this analysis view?

Imagine we use a column that gives the total price for the line (i.e. qt * unit_price), and we specify a group_operator along these lines (keeping in mind that OpenERP will add the braces after the operator): group_operator="(1.0/sum(product_qty))*sum"

This way when the grouping is done it should execute this:
    SELECT (1.0/sum(product_qty))*sum(total_price) FROM ...

Would it work?

Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello,

Right now we have removed 'average price' field from sql view, _columns and tree view Because the current group_by system does not support this kind of computation.

Its fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3.
Rev-id: <email address hidden>
Rev-no: 4627

It will be merged soon with Addons3 branch.

Thanks for reporting.

Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
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.