feat(fusion_accounting_reports): seed 3 partner-grouped reports
Adds Aged Receivable, Aged Payable, and Partner Ledger as fusion.report records using the new compute_partner_grouped engine method. REPORT_TYPES is extended with aged_receivable / aged_payable / partner_ledger so each report has a unique report_type. The HTTP controller dispatches these to engine.compute_partner_grouped with the appropriate account_type via PARTNER_GROUPED_ACCOUNT_TYPE. Output includes per-partner aging buckets: current, 1-30, 31-60, 61-90, 90+ days. Westin total: 4 + 4 + 3 = 11 of Enterprise's 22 standard reports. Made-with: Cursor
This commit is contained in:
@@ -18,7 +18,16 @@ from ..services.date_periods import Period
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
REPORT_TYPES = {'pnl', 'balance_sheet', 'trial_balance', 'general_ledger'}
|
||||
REPORT_TYPES = {
|
||||
'pnl', 'balance_sheet', 'trial_balance', 'general_ledger',
|
||||
'aged_receivable', 'aged_payable', 'partner_ledger',
|
||||
}
|
||||
|
||||
PARTNER_GROUPED_ACCOUNT_TYPE = {
|
||||
'aged_receivable': 'asset_receivable',
|
||||
'aged_payable': 'liability_payable',
|
||||
'partner_ledger': 'asset_receivable',
|
||||
}
|
||||
|
||||
|
||||
def _parse_date(value):
|
||||
@@ -76,6 +85,14 @@ class FusionReportsController(http.Controller):
|
||||
if report_type == 'trial_balance':
|
||||
period = _build_period(date_from, date_to)
|
||||
return engine.compute_trial_balance(period, company_id=company_id)
|
||||
if report_type in PARTNER_GROUPED_ACCOUNT_TYPE:
|
||||
period = _build_period(date_from, date_to)
|
||||
return engine.compute_partner_grouped(
|
||||
period,
|
||||
account_type=PARTNER_GROUPED_ACCOUNT_TYPE[report_type],
|
||||
comparison=comparison,
|
||||
company_id=company_id,
|
||||
)
|
||||
# general_ledger
|
||||
period = _build_period(date_from, date_to)
|
||||
return engine.compute_gl(period, company_id=company_id)
|
||||
|
||||
Reference in New Issue
Block a user