fix miscalculation in aged partner balance na

This commit is contained in:
Marc Durepos 2024-05-28 15:41:13 -04:00
parent 6ffd75f299
commit 564f6e0222
2 changed files with 9 additions and 5 deletions

View file

@ -20,11 +20,11 @@ def post_init(env):
'availability_condition': 'always',
})
col_name_mapping = [
('At Date', '0-29'),
('1-30', '30-59'),
('31-60', '60-89'),
('61-90', '90-119'),
('91-120', '120-159'),
('At Date', 'Overdue'),
('1-30', '0-29'),
('31-60', '30-59'),
('61-90', '60-89'),
('91-120', '90-119'),
('Older', 'Later'),
]
for old_name, new_name in col_name_mapping:

View file

@ -51,10 +51,14 @@ class AgedPartnerBalanceCustomHandler(models.AbstractModel):
report._check_groupby_fields((next_groupby.split(',') if next_groupby else []) + ([current_groupby] if current_groupby else []))
def plus_days(date_obj, days):
return fields.Date.to_string(date_obj + relativedelta(days=days))
def minus_days(date_obj, days):
return fields.Date.to_string(date_obj - relativedelta(days=days))
date_to = fields.Date.from_string(options['date']['date_to'])
periods = [
(False, minus_days(date_to, 1))
(date_to, plus_days(date_to, 29)),
(plus_days(date_to, 30), plus_days(date_to, 59)),
(plus_days(date_to, 60), plus_days(date_to, 89)),