details:   https://code.tryton.org/tryton/commit/ce853d2f1ca0
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Thu Apr 09 18:24:39 2026 +0200
description:
        Cast to integer reporting ID calculated using SQL Power

        Closes #14732
        (grafted from 2119eb22022587466530ff1221b13397c660cfaf)
diffstat:

 modules/sale/sale_reporting.py          |  5 +++--
 modules/stock/stock_reporting_margin.py |  3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 4cd89415bd11 -r ce853d2f1ca0 modules/sale/sale_reporting.py
--- a/modules/sale/sale_reporting.py    Thu Apr 09 17:28:37 2026 +0200
+++ b/modules/sale/sale_reporting.py    Thu Apr 09 18:24:39 2026 +0200
@@ -417,7 +417,7 @@
         # by using a number one order bigger.
         nb_category = category.select(
             Power(10, (Ceil(Log(Max(category.id))) + Literal(1))))
-        return Min(line.id * nb_category + party_category.id)
+        return cls.id.sql_cast(Min(line.id * nb_category + party_category.id))
 
     @classmethod
     def _group_by(cls, tables, withs):
@@ -664,7 +664,8 @@
         # by using number one order bigger.
         nb_category = category.select(
             Power(10, (Ceil(Log(Max(category.id))) + Literal(1))))
-        return Min(line.id * nb_category + template_category.id)
+        return cls.id.sql_cast(
+            Min(line.id * nb_category + template_category.id))
 
     @classmethod
     def _group_by(cls, tables, withs):
diff -r 4cd89415bd11 -r ce853d2f1ca0 modules/stock/stock_reporting_margin.py
--- a/modules/stock/stock_reporting_margin.py   Thu Apr 09 17:28:37 2026 +0200
+++ b/modules/stock/stock_reporting_margin.py   Thu Apr 09 18:24:39 2026 +0200
@@ -482,7 +482,8 @@
         # by using number one order bigger.
         nb_category = category.select(
             Power(10, (Ceil(Log(Max(category.id))) + Literal(1))))
-        return Min(move.id * nb_category + template_category.id)
+        return cls.id.sql_cast(
+            Min(move.id * nb_category + template_category.id))
 
     @classmethod
     def _group_by(cls, tables, withs):

Reply via email to