[FIX] point_of_sale: no need to specify numeric digits
authorDenis Ledoux <dle@odoo.com>
Tue, 21 Oct 2014 08:13:44 +0000 (10:13 +0200)
committerDenis Ledoux <dle@odoo.com>
Tue, 21 Oct 2014 08:13:44 +0000 (10:13 +0200)
In the report pos order, average_price was set as a numeric(16,2), therefore, if the amount was too big, it led to a psql crash:
A field with precision 16, scale 2 must round to an absolute value less than 10^14.

addons/point_of_sale/report/pos_order_report.py

index f0b9c1e..1f053a0 100644 (file)
@@ -61,7 +61,7 @@ class pos_order_report(osv.osv):
                     sum(l.qty * u.factor) as product_qty,
                     sum(l.qty * l.price_unit) as price_total,
                     sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
-                    (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
+                    (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal as average_price,
                     sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
                     to_char(s.date_order, 'YYYY') as year,
                     to_char(s.date_order, 'MM') as month,