Issue 9318

Title
aged balance has problem with months
Priority
feature
Status
resolved
Nosy list
ced, reviewbot, risto3, roundup-bot
Assigned to
ced
Keywords
review

Created on 2020-05-09.18:18:35 by risto3, last changed 2 months ago by roundup-bot.

Messages

New changeset b4e352fb1311 by Cédric Krier in branch 'default':
Add more term units to aged balance
https://hg.tryton.org/tryton-env/rev/b4e352fb1311
New changeset 35a3c18b040d by Cédric Krier in branch 'default':
Add more term units to aged balance
https://hg.tryton.org/modules/account/rev/35a3c18b040d
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-22.00:34:08

It is not really a bug but more a feature request to support more term units.
Indeed the current day and month are mainly the same unit with a factor 30 (normalized month).
But it is not really useful and it will be better to have weeks, months and years which are not factor of days.

Author: [hidden] (risto3)
Date: 2020-05-09.18:18:34
as indicated in https://discuss.tryton.org/t/how-to-print-balance-by-party-by-account/1976/5, there appears to be a problem with dates at least when using months.

The following applied to get_unit_factor() seems to easily fix the issue:
@@ -2194,9 +2194,9 @@ class AgedBalance(ModelSQL, ModelView):
         context = Transaction().context
         unit = context.get('unit', 'day')
         if unit == 'month':
-            return datetime.timedelta(days=30)
+            return relativedelta(months=1)
         elif unit == 'day':
-            return datetime.timedelta(days=1)
+            return relativedelta(days=1)
History
Date User Action Args
2020-11-12 22:08:30roundup-botsetmessages: + msg61878
2020-11-12 22:08:26roundup-botsetmessages: + msg61877
nosy: + roundup-bot
status: testing -> resolved
2020-10-22 10:39:57reviewbotsetmessages: + msg61148
2020-10-22 01:08:38reviewbotsetmessages: + msg61147
nosy: + reviewbot
2020-10-22 00:35:39cedsetkeyword: + review
reviews: 304581002
status: in-progress -> testing
2020-10-22 00:34:08cedsetassignedto: ced
component: + account
messages: + msg61146
nosy: + ced
priority: bug -> feature
status: unread -> in-progress
type: feature request
2020-05-09 18:18:35risto3create

Showing 10 items. Show all history (warning: this could be VERY long)