From 06031a2e79a6ae2c0ec306ea8777ce4dd2f8e3b7 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Tue, 22 Apr 2025 15:14:06 +0200 Subject: [PATCH] Addressed comments --- ...> int_xero__host_resolutions_payments.sql} | 16 ++++--------- models/intermediate/xero/schema.yml | 23 ++++++++++++------- 2 files changed, 20 insertions(+), 19 deletions(-) rename models/intermediate/xero/{int_xero__resolutions_payments.sql => int_xero__host_resolutions_payments.sql} (87%) diff --git a/models/intermediate/xero/int_xero__resolutions_payments.sql b/models/intermediate/xero/int_xero__host_resolutions_payments.sql similarity index 87% rename from models/intermediate/xero/int_xero__resolutions_payments.sql rename to models/intermediate/xero/int_xero__host_resolutions_payments.sql index 37342af..2238c8b 100644 --- a/models/intermediate/xero/int_xero__resolutions_payments.sql +++ b/models/intermediate/xero/int_xero__host_resolutions_payments.sql @@ -3,13 +3,6 @@ {% set resolutions_credited_account_code = "('316')" %} {% set resolutions_credited_documents = "('ACCRECCREDIT')" %} -{{ - config( - materialized="table", - unique_key=["id_account", "account_code", "account_name", "line_description"], - ) -}} - with int_xero__sales_denom_mart as ( select * from {{ ref("int_xero__sales_denom_mart") }} @@ -22,11 +15,12 @@ with ), int_xero__contacts as (select * from {{ ref("int_xero__contacts") }}) select + blt.id_line_item, + 'bank transaction' as document_class, blt.id_account, blt.account_code, blt.account_name, blt.line_description, - 'BANK_TRANSACTION' as document_type, bt.transaction_date_utc, xc.id_deal, blt.quantity, @@ -47,13 +41,14 @@ inner join left join int_xero__contacts xc on xc.id_contact = bt.id_contact union all select + sdm.id_line_item, sdm.id_account, sdm.account_code, sdm.account_name, sdm.line_description, - sdm.document_type, + sdm.document_class, sdm.document_is_effective_at_end_of_month_utc, - xc.id_deal, + sdm.id_deal, sdm.quantity, sdm.unit_amount, sdm.line_amount_local_curr, @@ -64,7 +59,6 @@ select sdm.tax_amount_in_gbp, sdm.document_currency_iso_4217 from int_xero__sales_denom_mart sdm -left join int_xero__contacts xc on xc.id_contact = sdm.id_contact where sdm.account_name in {{ resolutions_credited_account_code }} and sdm.document_type in {{ resolutions_credited_documents }} diff --git a/models/intermediate/xero/schema.yml b/models/intermediate/xero/schema.yml index 64725ec..2508a40 100644 --- a/models/intermediate/xero/schema.yml +++ b/models/intermediate/xero/schema.yml @@ -454,19 +454,26 @@ models: "Year-to-date (YTD) total of sales amount without taxes (GBP) from the start of the previous fiscal year up to the same month." - - name: int_xero__resolutions_payments + - name: int_xero__host_resolutions_payments description: | This model provides a view of transactions related to resolutions, including details such as transaction date, associated account, and transaction amount. - Previously, all resolution-related transaction data was stored in the `int_xerp__bank_transactions` + Previously, all resolution-related transaction data was stored in the `int_xero__bank_transactions` model. However, some resolution transactions have been, and will continue to be, credited through - the standard invoicing process — these are stored in the `int_xerp__sales_denom_mart` model. + the standard invoicing process — these are stored in the `int_xero__sales_denom_mart` model. - This model is built by joining the `int_xerp__bank_transactions` and `int_xerp__sales_denom_mart` + This model is built by joining the `int_xero__bank_transactions` and `int_xero__sales_denom_mart` models to provide a unified view of resolution transactions. columns: + - name: id_line_item + data_type: text + description: "Unique identifier of the line item associated with the transaction." + data_tests: + - not_null + - unique + - name: id_account data_type: text description: "Unique identifier of the account associated with the transaction." @@ -489,15 +496,15 @@ models: data_type: text description: "Description of the transaction line item." - - name: document_type + - name: document_class data_type: text - description: "The type of document associated with the transaction." + description: "Indicates whether the record belongs in an a credit note or a bank transaction." data_tests: - not_null - accepted_values: values: - - "ACCRECCREDIT" - - "BANK_TRANSACTION" + - "credit note" + - "bank transaction" - name: transaction_date_utc data_type: date