details:   https://code.tryton.org/tryton/commit/dd8bcb5fff5b
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Dec 12 15:30:28 2025 +0100
description:
        Use default month value for the period of sale and purchase reporting
diffstat:

 modules/purchase/purchase_reporting.py |  5 +++--
 modules/sale/sale_reporting.py         |  4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 66f50ae467e5 -r dd8bcb5fff5b modules/purchase/purchase_reporting.py
--- a/modules/purchase/purchase_reporting.py    Mon Dec 29 12:36:26 2025 +0100
+++ b/modules/purchase/purchase_reporting.py    Fri Dec 12 15:30:28 2025 +0100
@@ -124,7 +124,7 @@
             'year': relativedelta(years=1),
             'month': relativedelta(months=1),
             'day': relativedelta(days=1),
-            }.get(context.get('period'))
+            }.get(context.get('period', 'month'))
 
     def get_trend(self, name):
         name = name[:-len('_trend')]
@@ -150,7 +150,8 @@
     def _column_date(cls, tables):
         context = Transaction().context
         purchase = tables['line.purchase']
-        date = DateTrunc(context.get('period'), purchase.purchase_date)
+        date = DateTrunc(
+            context.get('period', 'month'), purchase.purchase_date)
         date = cls.date.sql_cast(date)
         return date
 
diff -r 66f50ae467e5 -r dd8bcb5fff5b modules/sale/sale_reporting.py
--- a/modules/sale/sale_reporting.py    Mon Dec 29 12:36:26 2025 +0100
+++ b/modules/sale/sale_reporting.py    Fri Dec 12 15:30:28 2025 +0100
@@ -195,7 +195,7 @@
             'year': relativedelta(years=1),
             'month': relativedelta(months=1),
             'day': relativedelta(days=1),
-            }.get(context.get('period'))
+            }.get(context.get('period', 'month'))
 
     def get_trend(self, name):
         name = name[:-len('_trend')]
@@ -221,7 +221,7 @@
     def _column_date(cls, tables, withs):
         context = Transaction().context
         line = tables['line']
-        date = DateTrunc(context.get('period'), line.date)
+        date = DateTrunc(context.get('period', 'month'), line.date)
         date = cls.date.sql_cast(date)
         return date
 

Reply via email to