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/invoice discount consideration #85

Merged

Conversation

fivetran-joemarkiewicz
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz commented Apr 11, 2023

PR Overview

This PR will address the following Issue/Feature: Issue #59

This PR will result in the following new package version: v0.9.0

This has some pretty large changes included. As such, I would be most comfortable with this update being categorized as a breaking change.

Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:

This PR in particular modifies the int_quickbooks__invoice_double_entry model pretty significantly to account for invoice discounts as well as leveraging the new detail_type field (added in November of 2021) to more accurately identify which items of the invoice line items should be considered in the downstream general ledger entries (specifically wanting to not include SubTotalLineDetail types.

  • Detail Type Addition

    • Previously the package did long formed coalesce statements to identify if the invoice line item was meant to be captured. The updates in this PR adjust the logic to leverage the detail_type field instead (if available). For the records where this is not available, we will use the same coalesce statement from previous versions of the package.
  • Invoice Discount Consideration

    • When a line item is considered a true discount it needs to be captured a bit differently as it is considered a contra revenue account and should reduce the amount of revenue. In these cases we want to reflect a debit entry to the respective discount account id and then a credit to accounts receivable. Since this is different from the normal invoice line item behavior, the union statements have been adjusted to reflect this.
    • Refer to the DECISIONLOG update in this PR for a more detailed explanation of this behavior in action.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt compile
    • Same comment from the other PR, this is currently not working and there is an open FR to investigate this.
  • dbt run –full-refresh
  • dbt run
  • dbt test
  • dbt run –vars (if applicable)

Before marking this PR as “ready for review” the following have been applied:

  • The appropriate issue has been linked and tagged
  • You are assigned to the corresponding issue and this PR
  • BuildKite integration tests are passing

Detailed Validation

Please acknowledge that the following validation checks have been performed prior to marking this PR as “ready for review”:

  • You have validated these changes and assure this PR will address the respective Issue/Feature.
  • You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
  • You have provided details below around the validation steps performed to gain confidence in these changes.

This package was validated with a customer dataset and verified that before these changes the profit and loss statement did not tie out to the expected revenue and expense totals; however, with the changes in this PR (particularly taking into account the invoice discount) the revenue and expense totals in the downstream profit and loss statement tied out as expected.

Additionally, I was able to validate that the delta on the revenue side of the profit and loss for a given month was tied back exactly to the invoice discounts that were not previously being recorded by the package. Please discuss with @fivetran-joemarkiewicz for additional validation steps and confirmation.

Standard Updates

Please acknowledge that your PR contains the following standard updates:

  • Package versioning has been appropriately indexed in the following locations:
    • indexed within dbt_project.yml
    • indexed within integration_tests/dbt_project.yml
  • CHANGELOG has individual entries for each respective change in this PR
  • README updates have been applied (if applicable)
  • DECISIONLOG updates have been updated (if applicable)
  • Appropriate yml documentation has been added (if applicable)

dbt Docs

Please acknowledge that after the above were all completed the below were applied to your branch:

  • docs were regenerated (unless this PR does not include any code or yml updates)

If you had to summarize this PR in an emoji, which would it be?

🥏

@fivetran-joemarkiewicz fivetran-joemarkiewicz changed the base branch from main to release/v0.9.0 April 11, 2023 20:33
@fivetran-joemarkiewicz fivetran-joemarkiewicz marked this pull request as ready for review April 12, 2023 21:34
@fivetran-joemarkiewicz fivetran-joemarkiewicz mentioned this pull request Apr 12, 2023
8 tasks
Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

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

@fivetran-joemarkiewicz Mostly good to go, just needs a bit of polish!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
integration_tests/seeds/invoice_line_data.csv Outdated Show resolved Hide resolved
# - package: fivetran/quickbooks_source
Copy link
Contributor

Choose a reason for hiding this comment

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

standard revert packages message

fivetran-joemarkiewicz and others added 4 commits April 20, 2023 10:06
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
@fivetran-joemarkiewicz
Copy link
Contributor Author

Thanks for reviewing @fivetran-avinash! All updates have been applied and comments have been replied to. Let me know if you have any other questions 😄

Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

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

Just one question about the invoice_double_entry changes but approved otherwise!

{% else %}
coalesce(invoice_lines.account_id, items.income_account_id) as account_id,
case when invoice_lines.detail_type is not null then invoice_lines.detail_type
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick clarifying question: The when clause was changed because detail_type will have the SubTotalLineDetail? What does DescriptionOnly refer to, an invoice line item ro wwhere there's an amount but no id associated with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly!

@fivetran-joemarkiewicz fivetran-joemarkiewicz merged commit aadd941 into release/v0.9.0 Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants