-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature: Multicurrency support (plus some bug fixes for double entry models) #134
Feature: Multicurrency support (plus some bug fixes for double entry models) #134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash fantastic work on this PR! I have a few questions, comments, and suggestions below. Let me know if you want to sync on any of my comments. Thanks!
integration_tests/tests/consistency/consistency_balance_sheet_amount.sql
Outdated
Show resolved
Hide resolved
models/double_entry_transactions/int_quickbooks__sales_receipt_double_entry.sql
Outdated
Show resolved
Hide resolved
cast(null as {{ dbt.type_string() }}) as estimate_status, | ||
|
||
{% endif %} | ||
|
||
invoice_link.due_date as due_date, | ||
(payments.total_amount * coalesce(payments.exchange_rate, 1)) as total_current_converted_payment, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment to a previous question, is there a related field to this which is available in prod?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment on int_quickbooks__invoice_join
for the update
packages.yml
Outdated
# version: [">=0.10.0", "<0.11.0"] | ||
|
||
- git: https://github.com/fivetran/dbt_quickbooks_source.git | ||
revision: feature/add-home-total-amount-to-deposit | ||
warn-unpinned: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder to swap before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-joemarkiewicz Addressed all PR notes/reran tests/regenerated docs. Should be ready for re-review.
dev as ( | ||
select * | ||
--remove the below line before merging to main | ||
except(converted_amount, total_converted_amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash Reminder to remove except clause before merging.
dev as ( | ||
select * | ||
--remove the below line before merging to main | ||
except (total_converted_amount, estimate_total_converted_amount, total_current_converted_payment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash Reminder to remove except clause before merging.
integration_tests/tests/consistency/consistency_balance_sheet_amount.sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash great work on this PR and thanks for addressing the outstanding items. I have a few very minor comments. Otherwise this PR is good to go!
README.md
Outdated
|
||
> Please be aware that the [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) packages were developed with single currency company data. As such, the package models will not reflect accurate totals if your QuickBooks account has Multi-Currency enabled. | ||
> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small wording suggestion update.
> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration). | |
> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash amounts. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
README.md
Outdated
> Please be aware that the [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) packages were developed with single currency company data. As such, the package models will not reflect accurate totals if your QuickBooks account has Multi-Currency enabled. | ||
> [dbt_quickbooks](https://github.com/fivetran/dbt_quickbooks) and [dbt_quickbooks_source](https://github.com/fivetran/dbt_quickbooks_source) now supports multicurrency by bringing in values by specifying `*_converted_*` values for cash. More details are [available in the DECISIONLOG](https://github.com/fivetran/dbt_quickbooks/blob/main/DECISIONLOG.md#multicurrency-vs-single-currency-configuration). | ||
|
||
There are specific limitations if you need converted amounts for credit card payments and transfers, as we do not currently have the ability to validate a best approach to convert the original amounts into their proper home currency. [Please open an issue with us](https://github.com/fivetran/dbt_quickbooks/issues/new/choose) if this is critical and/or you believe you can help contribute to scoping out adding that functionality in.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this section! One small edit.
There are specific limitations if you need converted amounts for credit card payments and transfers, as we do not currently have the ability to validate a best approach to convert the original amounts into their proper home currency. [Please open an issue with us](https://github.com/fivetran/dbt_quickbooks/issues/new/choose) if this is critical and/or you believe you can help contribute to scoping out adding that functionality in.. | |
There are specific limitations if you need converted amounts for credit card payments and transfers, as we do not currently have the ability to validate a best approach to convert the original amounts into their proper home currency. [Please open an issue with us](https://github.com/fivetran/dbt_quickbooks/issues/new/choose) if this is critical and/or you believe you can help contribute to scoping out adding that functionality in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash This is generally looking great--I just have one small question!
integration_tests/dbt_project.yml
Outdated
# For validation testing. | ||
# This below vars configuration is needed for the `general_ledger_amounts_match` macro. | ||
using_bill: true | ||
using_credit_card_payment_txn: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the default for using_credit_card_payment_txn
is false but we're setting it true here, should we set it to false in this line so one run tests true and the other false? Or, you could just comment out this L70 when sending to buildkite?
Also I'm not sure if it would be related to this PR, it looks like the default value is set as false everywhere except for here. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-catfritz Oh good catch. This should have been commented out, will fix now.
In the second link, I believe this is false by default? It's conditional on the variable being true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-avinash According to the docs, {% var('using_credit_card_payment_txn', True) %}
means the default value is True.
The line {% if var('using_credit_card_payment_txn', True) %}
simply evaluates if the variable value provided is true/false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fivetran-catfritz Ahh, good catch! Yes it should probably be consistent then.
Interestingly, I don't think the behavior changes very much unless the variable is not set, but since it is set by default the cases that it wouldn't be set are probably rare, which is why this hasn't been flagged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! LGTM.
PR Overview
This PR will address the following Issue/Feature: [#128] (duplicate issue: #115), as well as bugfix [#135]. (Issue #127 was also validated/merged into this PR branch as well)
This PR will result in the following new package version:
v0.14.0The introduction of new fields to support multicurrency makes this a breaking change.
Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:
🚨 Breaking Changes 🚨
Feature Requests: Multicurrency Support
adjusted_converted_amount
,running_converted_balance
adjusted_amount
,running_balance
period_net_converted_change
,period_beginning_converted_balance
,period_ending_converted_balance
period_net_change
,period_beginning_balance
,period_ending_balance
converted_amount
amount
converted_amount
amount
cash_converted_ending_period
,cash_converted_beginning_period
,cash_converted_net_period
cash_ending_period
,cash_beginning_period
,cash_net_period
total_converted_amount
,estimate_total_converted_amount
,total_current_converted_payment
total_amount
,estimate_total_amount
,total_current_payment
total_converted_amount
,converted_amount
total_amount
,amount
*_converted_*
type fields in our intermediate models to convert amounts where exchange rates exist for those transactions. If there is no exchange rate, these*_converted_*
fields will default back to the already existing fields created for single currency, and all downstream calculations should match the single currency amount, balance and cash values. (PR #134)currency_id
value in theaccounts
source table for those transactions. (PR #134)analysis
folder, added theconverted_balance
to thequickbooks__balance_sheet
andending_converted_balance
to thequickbooks__income_statement
models. (PR #134)Bug Fixes
int_quickbooks__sales_receipt_double_entry
model to bring in these values properly as negative adjusted amounts in thequickbooks__general_ledger
.(PR #130)
int_quickbooks__invoice_double_entry
to filter out 'Accounts Receivable' accounts that are inactive. (PR #134)Under the Hood
quickbooks__general_ledger
,quickbooks__general_ledger_by_period
,quickbooks__balance_sheet
,quickbooks__cash_flow_statement
andquickbooks__profit_and_loss
models. (PR #130) & (PR 134)Documentation Update
PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
Before marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please share any and all of your validation steps:
A host of new validation tests have been added to our most used end models, as mentioned above. These will check for consistency of amounts between dev and prod (we only look at the regular
amount
for now, asconverted_amount
doesn't exist in prod at this moment--we will probably need to update this in a future round of validation testing), and then integrity tests assessing no changes on amounts and converted amounts for the various end model grains.There were also regular consistency tests looking at row values for
ap_ar_enhanced
andexpense_sales_enhanced
. These tests will be modified before deploying tomain
.One thing to call out is you will have to configure the vars in the
integration_tests/dbt_project.yml
to get theenabled_union_models
macro to work properly in thegeneral_ledger_amounts_match
test model.If you had to summarize this PR in an emoji, which would it be?
💴 💷 💶