details: https://code.tryton.org/tryton/commit/5c67a5358f10
branch: default
user: Cédric Krier <[email protected]>
date: Fri Oct 09 23:25:45 2026 +0200
description:
Cast currency rounding when comparing against sum of debit - credit for
SQLite
The Decimal value is adapted as string for SQLite backend so without
column
affinity to trigger conversion, SQLite compares REAL against TEXT. And
for
SQLite's comparison ordering, numeric values sort before text values.
Closes #15158
diffstat:
modules/account/move.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (33 lines):
diff -r b199c806391b -r 5c67a5358f10 modules/account/move.py
--- a/modules/account/move.py Fri Oct 09 12:42:25 2026 +0200
+++ b/modules/account/move.py Fri Oct 09 23:25:45 2026 +0200
@@ -355,9 +355,11 @@
'''
pool = Pool()
MoveLine = pool.get('account.move.line')
+ Currency = pool.get('currency.currency')
line = MoveLine.__table__()
transaction = Transaction()
cursor = transaction.connection.cursor()
+ cast = Currency.rounding.sql_cast
for company, moves in groupby(moves, key=lambda m: m.company):
currency = company.currency
@@ -370,7 +372,7 @@
group_by=line.move,
having=Abs(Round(
Sum(line.debit - line.credit),
- currency.digits)) < abs(currency.rounding))
+ currency.digits)) < cast(abs(currency.rounding)))
cursor.execute(*line.update(
[line.state],
['valid'],
@@ -382,7 +384,7 @@
group_by=line.move,
having=Abs(Round(
Sum(line.debit - line.credit),
- currency.digits)) >= abs(currency.rounding))
+ currency.digits)) >= cast(abs(currency.rounding)))
cursor.execute(*line.update(
[line.state],
['draft'],