Skip to content

Feature/new journal cash models - #78

Merged
fivetran-avinash merged 22 commits into
mainfrom
feature/new-journal-cash-models
Jul 8, 2026
Merged

fivetran-avinash merged 22 commits into
mainfrom
feature/new-journal-cash-models

Conversation

@fivetran-avinash

@fivetran-avinash fivetran-avinash commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

PR Overview

Package version introduced in this PR:

  • 1.5.0

This PR addresses the following Issue/Feature(s):

  • GA-1025972

Summary of changes:

  • Pairs the new Xero journal cash updates to create a cash general ledger mirroring the existing general ledger.

Submission Checklist

  • Alignment meeting with the reviewer (if needed)
    • Timeline and validation requirements discussed
  • Provide validation details:
    • Validation Steps: Check for unintentional effects (e.g., add/run consistency & integrity tests)
    • Testing Instructions: Confirm the change addresses the issue(s)
    • Focus Areas: Complex logic or queries that need extra attention
  • Merge any relevant open PRs into this PR

Changelog

  • Draft changelog for PR
  • Final changelog for release review

fivetran-avinash and others added 3 commits June 28, 2026 18:32
- Add all untracked cash model files: stg_xero__journal_cash, stg_xero__journal_cash_line, stg_xero__journal_cash_line_has_tracking_category (tmp + staging layers), int_xero__journal_cash_line_pivoted_tracking_categories, xero__cash_general_ledger, get_*_columns macros, and integration test seeds
- Add consistency_cash_general_ledger.sql integration test to match pattern of all other end models
- Fix README source table links pointing to feature/new-union-data (now point to main)
- Add not_null tests to journal_id and journal_line_id in stg_xero__journal_cash_line_has_tracking_category

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ensures the second dbt run verifies the package executes cleanly when
cash-basis journal models are turned off, closing a coverage gap where
all three CI passes ran with xero__using_journal_cash: true.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fivetran-avinash fivetran-avinash self-assigned this Jun 30, 2026
@fivetran-avinash fivetran-avinash added the docs:ready Triggers the docs generator workflow. label Jul 6, 2026
@fivetran-avinash
fivetran-avinash marked this pull request as ready for review July 6, 2026 18:52
@fivetran-avinash fivetran-avinash added docs:ready Triggers the docs generator workflow. and removed docs:ready Triggers the docs generator workflow. labels Jul 7, 2026

@fivetran-catfritz fivetran-catfritz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tiny yml update needed, but also there are a couple more philosophical questions on columns.

Comment thread dbt_project.yml Outdated
journal_cash: "{{ source('xero', 'journal_cash') }}"
journal_cash_line: "{{ source('xero', 'journal_cash_line') }}"
journal_cash_line_has_tracking_category: "{{ source('xero', 'journal_cash_line_has_tracking_category') }}"
xero_sources: []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xero_sources: []

I think we should remove this since you provided default values but let me know otherwise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

description: >
The source where this data was pulled from. If you are making use of the `union_schemas` variable, this will be the source schema.
If you are making use of the `union_databases` variable, this will be the source database. If you are not unioining together multiple
If you are making use of the `union_databases` variable, this will be the source database. If you are not unioning together multiple

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha oh dear... I think this made it into several packages with our last round of updates. Good catch tho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha it happens

accounts.account_class,
'cash' as accounting_basis,

case when journals.source_type in ('ACCPAY', 'ACCREC') then journals.source_id end as invoice_id,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question on invoice_id (Claude flagged):

According to Claude, ACCPAY and ACCREC are accrual-basis source types that shouldn't appear in a cash journal, so this will never fire. In the cash context, payment_id already plays the equivalent role — it captures AR/AP transactions at the payment stage rather than invoice creation. So there isn't really a cash-basis equivalent for invoice_id. Should we remove it in favor of keeping only what's conceptually valid for cash, or keep it for structural consistency with xero__general_ledger? Maybe discuss with the team?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested changes of docs updates applied


select
first_contact.*,
contacts.contact_name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another Claude-flagged question:

According to Claude, contact_id and contact_name will be NULL for payment-type source types in xero__cash_general_ledger (since ACCRECPAYMENT, ACCPAYPAYMENT, and the other payment types that map to payment_id). This is because contact resolution only works through the invoice, bank transaction, and credit note joins — and there's no payment staging model in the package to fill the gap.

This same limitation exists in xero__general_ledger, but it's less noticeable there since accrual journals also include the original invoice entries (ACCREC/ACCPAY) which do resolve contacts. In the cash ledger, payments are the only entries, so a larger share of rows will have NULL contact info.

Not suggesting we fix it in this PR — adding a payment model is a bigger lift. But it might be worth updating the contact_id field description in xero.yml to set expectations:

- name: contact_id
  description: >
    The identifier for the contact associated with the source transaction, where resolvable.
    Will be null for payment source types (e.g. ACCRECPAYMENT, ACCPAYPAYMENT) as the package
    does not currently include a payment staging model.

Or, we just don't bother with the contact_name.

Maybe another question for the team.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested changes of docs updates applied

journal_lines.tax_name,
journal_lines.tax_type,
accounts.account_class,
'cash' as accounting_basis,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add a similar column 'accrual' as accounting_basis to xero__general_ledger?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! updated.

@fivetran-avinash fivetran-avinash added docs:ready Triggers the docs generator workflow. and removed docs:ready Triggers the docs generator workflow. labels Jul 7, 2026
@fivetran-avinash

fivetran-avinash commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

A tiny yml update needed, but also there are a couple more philosophical questions on columns.

@fivetran-catfritz

Ready for re-review once docs get regenerated /Buildkite passes

@fivetran-catfritz fivetran-catfritz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@fivetran-avinash fivetran-avinash added docs:ready Triggers the docs generator workflow. and removed docs:ready Triggers the docs generator workflow. labels Jul 8, 2026
@fivetran-avinash
fivetran-avinash merged commit ef8819e into main Jul 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs:ready Triggers the docs generator workflow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants