changeset 0d00a7822028 in modules/account_payment:default
details: 
https://hg.tryton.org/modules/account_payment?cmd=changeset&node=0d00a7822028
description:
        Cast payment_amount value when searching

        SQLite does not evaluate the HAVING clause correctly without an 
explicit cast.

        issue11102
        review393291002
diffstat:

 account.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 2348e2a578a4 -r 0d00a7822028 account.py
--- a/account.py        Sat Dec 18 16:29:39 2021 +0100
+++ b/account.py        Tue Jan 11 23:00:09 2022 +0100
@@ -118,7 +118,8 @@
         second_amount = Abs(table.amount_second_currency) - payment_amount
         amount = Case((table.second_currency == Null, main_amount),
             else_=second_amount)
-        value = cls.payment_amount.sql_format(value)
+        value = cls.payment_amount._field.sql_cast(
+            cls.payment_amount.sql_format(value))
 
         query = (table
             .join(payment, type_='LEFT',

Reply via email to