Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] New variables to configure account type value filters #98

Merged
merged 12 commits into from
Aug 7, 2023
Merged
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# dbt_quickbooks v0.11.1
This PR includes the following updates:

## 🐛 Bug Fixes 🩹
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved
- Updated intermediate double entry models that have `account_type` and `account_sub_type` filters with configurable variables, since the type names used in the filter can be adjusted internally by QuickBooks customers. ([PR #98](https://github.com/fivetran/dbt_quickbooks/pull/98))
- Includes `items.asset_account_id` as the second field of the coalesce for the `payed_to_account_id` field within the `int_quickbooks__bill_payment_double_entry` model to ensure all account_id types are taken into consideration when mapping the transaction to the proper account. ([PR #100](https://github.com/fivetran/dbt_quickbooks/pull/100))

## 🎉 Feature Updates 🎉
- The intermediate models where these variables were introduced in the models below:

| **Updated model** | **New variables to filter on** |
| ----------| -------------------- |
| [int_quickbooks__bill_payment_double_entry](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.int_quickbooks__bill_payment_double_entry) | `quickbooks__accounts_payable_reference` |
| [int_quickbooks__credit_memo_double_entry](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.int_quickbooks__credit_memo_double_entry) | `quickbooks__accounts_receivable_reference` |
| [int_quickbooks__deposit_double_entry](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.int_quickbooks__deposit_double_entry) | `quickbooks__undeposited_funds_reference` |
| [int_quickbooks__invoice_double_entry](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.int_quickbooks__invoice_double_entry) | `quickbooks__sales_of_product_income_reference`, `quickbooks__accounts_receivable_reference` |
| [int_quickbooks__payment_double_entry](https://fivetran.github.io/dbt_quickbooks/#!/model/model.quickbooks.int_quickbooks__payment_double_entry) | `quickbooks__accounts_receivable_reference` |

## 🗒️ Documentation
- [Updated README with additional steps for configuration](https://github.com/fivetran/dbt_quickbooks/blob/main/README.md#optional-step-5-additional-configurations). This is an optional step since most customers will rely on the default account type/subtype values available.

## Contributors
- [@mikerenderco](https://github.com/mikerenderco) ([PR #100](https://github.com/fivetran/dbt_quickbooks/pull/100))

# dbt_quickbooks v0.11.0
## 🚨 Breaking Changes 🚨
[PR #95](https://github.com/fivetran/dbt_quickbooks/pull/95) includes the following updates:
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ vars:
quickbooks_union_databases: ['quickbooks_usa','quickbooks_canada'] # use this if the data is in different databases/projects but uses the same schema name
```

### Configuring Account Type Names
Within a few of the double entry models in this package a mapping takes place to assign certain transaction type's debits/credits to the appropriate offset account (ie. Accounts Payable, Accounts Receivable, Undeposited Funds, and SalesOfProductIncome) reference. While our current filtered logic within our intermediate models account for the default values, it's possible your use case relies on different account types to reference.

If you have a different value to reference for each type, you will need to configure the `account_type` and `account_sub_type` variables that account for these variables in your `dbt_project.yml`.

```yml
vars:
quickbooks__accounts_payable_reference: accounts_payable_value # 'Accounts Payable' is the default filter set for the account_type reference.
quickbooks__accounts_receivable_reference: account_receivable_value # 'Accounts Receivable' is the default filter set for the account_type reference.
quickbooks__undeposited_funds_reference: account_undeposited_funds_value # 'UndepositedFunds' is the default filter set for the account_subtype reference.
quickbooks__sales_of_product_income_reference: account_sales_of_product_income_value # 'SalesOfProductIncome' is the default filter set for the account_subtype reference.
```

### Customize the Cash Flow Model
**IMPORTANT**: It is very likely you will need to reconfigure your `cash_flow_type` to make sure your cash flow statement matches your specific use case. Please examine the following instructions.

Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2
name: 'quickbooks'

version: '0.11.0'
version: '0.11.1'

require-dbt-version: [">=1.3.0", "<2.0.0"]

Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion integration_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
dbt_modules/
dbt_packages/
logs/
logs/
env/
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'quickbooks_integration_tests'

version: '0.11.0'
version: '0.11.1'

profile: 'integration_tests'
config-version: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bill_join as (
bill_lines.index,
bills.transaction_date,
bill_lines.amount,
coalesce(bill_lines.account_expense_account_id, items.expense_account_id, items.parent_expense_account_id, items.expense_account_id, items.parent_income_account_id, items.income_account_id) as payed_to_account_id,
coalesce(bill_lines.account_expense_account_id,items.asset_account_id, items.expense_account_id, items.parent_expense_account_id, items.expense_account_id, items.parent_income_account_id, items.income_account_id) as payed_to_account_id,
bills.payable_account_id,
coalesce(bill_lines.account_expense_customer_id, bill_lines.item_expense_customer_id) as customer_id,
coalesce(bill_lines.item_expense_class_id, bill_lines.account_expense_class_id) as class_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ ap_accounts as (
source_relation
from accounts

where account_type = 'Accounts Payable'
where account_type = '{{ var('quickbooks__accounts_payable_reference', 'Accounts Payable') }}'
and is_active
and not is_sub_account
),

bill_payment_join as (

select
bill_payments.bill_payment_id as transaction_id,
bill_payments.source_relation,
Expand All @@ -51,7 +52,6 @@ bill_payment_join as (

inner join ap_accounts
on ap_accounts.source_relation = bill_payments.source_relation

),

final as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ df_accounts as (
source_relation
from accounts

where account_type = 'Accounts Receivable'
where account_type = '{{ var('quickbooks__accounts_receivable_reference', 'Accounts Receivable') }}'
and is_active
and not is_sub_account
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ uf_accounts as (
source_relation
from accounts

where account_sub_type = 'UndepositedFunds'
where account_sub_type = '{{ var('quickbooks__undeposited_funds_reference', 'UndepositedFunds') }}'
and is_active
and not is_sub_account
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ income_accounts as (
select *
from accounts

where account_sub_type = 'SalesOfProductIncome'
where account_sub_type = '{{ var('quickbooks__sales_of_product_income_reference', 'SalesOfProductIncome') }}'
),

bundle_income_accounts as (
Expand Down Expand Up @@ -90,7 +90,7 @@ ar_accounts as (
source_relation
from accounts

where account_type = 'Accounts Receivable'
where account_type = '{{ var('quickbooks__accounts_receivable_reference', 'Accounts Receivable') }}'
),

invoice_join as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ar_accounts as (
source_relation
from accounts

where account_type = 'Accounts Receivable'
where account_type = '{{ var('quickbooks__accounts_receivable_reference', 'Accounts Receivable') }}'
and is_active
and not is_sub_account
),
Expand Down