changeset 2477f6b74ce6 in modules/account:4.8
details: https://hg.tryton.org/modules/account?cmd=changeset;node=2477f6b74ce6
description:
        Ensure end periods is set when computing GL debit and credit amounts

        As the diference between end_periods and start_periods is computed, the 
end
        periods should have a value when the start periods is set otherwise and 
empty
        list of periods is used

        issue7838
        review47721002
        (grafted from e2cc34d17a012ec69e4333e2c388edac7b3a9130)
diffstat:

 account.py |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r a956a3854bf8 -r 2477f6b74ce6 account.py
--- a/account.py        Mon Dec 03 01:02:21 2018 +0100
+++ b/account.py        Mon Dec 03 11:35:19 2018 +0100
@@ -1350,6 +1350,14 @@
             period_ids = []
             if context.get('end_period'):
                 period = Period(context['end_period'])
+            else:
+                periods = Period.search([
+                        ('fiscalyear', '=', context.get('fiscalyear')),
+                        ('type', '=', 'standard'),
+                        ],
+                    order=[('start_date', 'DESC')], limit=1)
+                if periods:
+                    period, = periods
 
         if period:
             periods = Period.search([

Reply via email to