Number of decimals exceeds the limit
Having integrated the recent 6.8 commits containing the fix for #12587 (closed) we now have numerous breakages.
Most notably, anything that uses 'unit_price'... where apparently most everything since july of this year is stored with a digits value greater than the 5 places set for price_decimal in the configuration file.
An example exception (in French) trying to make a 'quotation' from a 'draft' purchase: 'Le nombre de décimales de la valeur "'0.0100000000000000'" pour le champs "Prix unitaire" sur "1 u ECO PARTICIPATION @ [58594]" de "Ligne d'achat" excède la limite de "5".
For example, to find all the tables with unit_price used:
# select t.table_name
from information_schema.tables t
inner join information_schema.columns c on c.table_name = t.table_name
and c.table_schema = t.table_schema
where c.column_name = 'unit_price'
and t.table_schema not in ('information_schema', 'pg_catalog')
and t.table_type = 'BASE TABLE'
order by t.table_schema;
table_name
---------------------------------
account_invoice_line
purchase_amendment_line
purchase_line
purchase_line__history
purchase_product_supplier_price
purchase_request_quotation_line
purchase_requisition_line
sale_amendment_line
sale_line
sale_line__history
stock_move
(11 lignes)
and some example values:
select id,unit_price,create_date FROM purchase_line where scale(unit_price) > 5 order by create_date limit 10;
id | unit_price | create_date
-------+------------------------+----------------------------
35791 | 336.0000000000000000 | 2023-07-18 08:59:37.533751
35793 | 39.2000000000000000 | 2023-07-18 09:03:01.338776
35797 | 1127.2000000000000000 | 2023-07-18 09:12:53.623855
35800 | 141.7500000000000000 | 2023-07-18 09:19:14.526788
35801 | 984.0000000000000000 | 2023-07-18 09:22:37.066773
35806 | 62.3000000000000000 | 2023-07-18 12:22:01.666764
35807 | 46.9600000000000000 | 2023-07-18 12:22:01.666764
36351 | 397.4300000000000000 | 2023-08-07 12:38:57.757206
36359 | 125.2100000000000000 | 2023-08-07 12:43:17.741312
36453 | 23944.1000000000000000 | 2023-08-08 12:41:16.694596
(10 lignes)
Here are the scale ranges for values currently in the db for purchase_line:
# select distinct scale(unit_price) from purchase_line;
scale
-------
5
4
0
2
1
3
16
(8 lignes)
with a test db, I forced the conversion to 5 if needed, for example:
# update purchase_line set unit_price=round(unit_price,5) where scale(unit_price) > 5;
# update purchase_line__history set unit_price=round(unit_price,5) where scale(unit_price) > 5;
where now it is possible to get a 'draft' purchase to 'quotation' or further.
How many other fields are affected? Is this sufficient?