details:   https://code.tryton.org/tryton/commit/b2dcfeb312e6
branch:    7.8
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 d270539883e9 -r b2dcfeb312e6 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
@@ -403,7 +403,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):
@@ -645,7 +645,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 d270539883e9 -r b2dcfeb312e6 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
@@ -468,7 +468,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