improvements to aged partner balance na reports
This commit is contained in:
parent
a050ce6221
commit
7cdefa1a9c
2 changed files with 25 additions and 2 deletions
|
|
@ -2,9 +2,32 @@ from . import models
|
|||
|
||||
|
||||
def post_init(env):
|
||||
env.['account.report'].search([('name', 'ilike', 'aged_%_report_na')]).unlink()
|
||||
new_receivable_report = env.ref('account_reports.aged_receivable_report').copy()
|
||||
new_payable_report = env.ref('account_reports.aged_payable_report').copy()
|
||||
new_receivable_report.line_ids.mapped('expression_ids').write({
|
||||
'formula': '_report_custom_engine_aged_receivable_na'
|
||||
})
|
||||
new_payable_report.line_ids.mapped('expression_ids').write({'formula': '_report_custom_engine_aged_payable_na'})
|
||||
new_receivable_report.write({
|
||||
'name': 'Aged Receivable - North America',
|
||||
'root_report_id': env.ref('account_reports.aged_receivable_report').id,
|
||||
'availability_condition': 'always',
|
||||
})
|
||||
new_payable_report.write({
|
||||
'name': 'Aged Payable - North America',
|
||||
'root_report_id': env.ref('account_reports.aged_payable_report').id,
|
||||
'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'),
|
||||
('Older', 'Later'),
|
||||
]
|
||||
for old_name, new_name in col_name_mapping:
|
||||
((new_payable_report | new_receivable_report)
|
||||
.mapped('column_ids')
|
||||
.filtered(lambda col: col.name == old_name)).write({'name': new_name})
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ class AgedPartnerBalanceCustomHandler(models.AbstractModel):
|
|||
|
||||
date_to = fields.Date.from_string(options['date']['date_to'])
|
||||
periods = [
|
||||
(False, fields.Date.to_string(date_to)),
|
||||
(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)),
|
||||
(plus_days(date_to, 90), plus_days(date_to, 119)),
|
||||
(plus_days(date_to, 120), False),
|
||||
(plus_days(date_to, 120), plus_days(date_to, 159)),
|
||||
(plus_days(date_to, 160), False),
|
||||
]
|
||||
|
||||
def build_result_dict(report, query_res_lines):
|
||||
|
|
|
|||
Loading…
Reference in a new issue