GL detail report

This commit is contained in:
2026-05-21 13:39:21 +02:00
parent f29664fd77
commit f16b334089
5 changed files with 253 additions and 0 deletions

View File

@@ -2103,6 +2103,8 @@ class AccountTestCase(
pool = Pool()
Detail = pool.get('account.general_ledger.detail')
DetailContext = pool.get('account.general_ledger.detail.context')
DetailReport = pool.get(
'account.general_ledger.detail.report', type='report')
for name in [
'row_type', 'account_code', 'transaction_currency',
@@ -2124,6 +2126,41 @@ class AccountTestCase(
self.assertIn('||', str(account_label))
self.assertNotIn(' + ', str(account_label))
self.assertEqual(account_label.params, ('', ' - ', ''))
self.assertEqual(
DetailReport.__name__, 'account.general_ledger.detail.report')
@with_transaction()
def test_general_ledger_detail_report_groups_by_account_currency(self):
"Test General Ledger Detail report groups lines by account and currency"
DetailReport = Pool().get(
'account.general_ledger.detail.report', type='report')
currency = type('Currency', (), {'id': 1})()
other_currency = type('Currency', (), {'id': 2})()
first = type('Line', (), {
'account_code': '1000 - Cash',
'account_name': 'Cash',
'transaction_currency': currency,
})()
second = type('Line', (), {
'account_code': '1000 - Cash',
'account_name': 'Cash',
'transaction_currency': currency,
})()
third = type('Line', (), {
'account_code': '2000 - Revenue',
'account_name': 'Revenue',
'transaction_currency': other_currency,
})()
groups = DetailReport._groups([first, second, third])
self.assertEqual(len(groups), 2)
self.assertEqual(groups[0]['account'], '1000 - Cash')
self.assertEqual(groups[0]['currency'], currency)
self.assertEqual(groups[0]['lines'], [first, second])
self.assertEqual(groups[1]['account'], '2000 - Revenue')
self.assertEqual(groups[1]['currency'], other_currency)
self.assertEqual(groups[1]['lines'], [third])
@with_transaction()
def test_general_ledger_detail_date_contexts(self):