← Back to team overview

openerp-expert-accounting team mailing list archive

Re: rounding issues stock product qty

 

Ferdinand Gassauer escribió:

Hello!

please could some of you check

select product_id ,sum(product_qty), round(sum(product_qty),2) from stock_move group by product_id having sum(product_qty) != round(sum(product_qty),4);

for 1 product I get

product_id | sum | round

------------+-----------+-----------

36 | 336708.38 | 336708.38


The query doesn't work for us, tested on Postgres 8.3 (Mint 7) and Postgres 8.4 (Ubuntu 8.10):

/ERROR:  function round(double precision, integer) does not exist
LINE 1: select product_id ,sum(product_qty), round(sum(product_qty),...
                                            ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

********** Error **********/

ERROR: function round(double precision, integer) does not exist



This other query does work thought:

select product_id ,sum(product_qty), round(CAST (sum(product_qty) AS numeric),2) from stock_move group by product_id having sum(product_qty) != round(CAST (sum(product_qty) AS numeric),4);

On one database it returns nothing, on other it returns this:
product_id | sum | round
------------+-----------+-----------
424 | 284.600000000001 | 284.60


Regards :)

--
Borja López Soilán
borjals@xxxxxxxxx

Pexego Sistemas Informáticos S.L.
Avenida de Magoi 66 - 27002 Lugo (España)
Tel./Fax 982801517
http://www.pexego.es

AVISO LEGAL - CLÁUSULA DE PRIVACIDAD
Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es usted el destinatario indicado, queda informado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

Follow ups

References