Merged PR 5083: Host Resolution model for report

# Description

New `xero__host_resolutions_payments` for Resolutions Host Payments Report.
I also updated a few descriptions from Superhog to Truvi

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [x] I have checked for DRY opportunities with other models and docs.
- [x] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Host Resolution model for report

Related work items: #29373
This commit is contained in:
Joaquin Ossa 2025-04-29 10:09:04 +00:00
commit 0bd26ab4c0
4 changed files with 191 additions and 8 deletions

View file

@ -25,6 +25,7 @@ select
blt.account_name, blt.account_name,
blt.line_description, blt.line_description,
bt.transaction_date_utc, bt.transaction_date_utc,
bt.id_contact,
xc.id_deal, xc.id_deal,
blt.quantity, blt.quantity,
blt.unit_amount, blt.unit_amount,
@ -51,6 +52,7 @@ select
sdm.account_name, sdm.account_name,
sdm.line_description, sdm.line_description,
sdm.document_issued_date_utc, sdm.document_issued_date_utc,
sdm.id_contact,
sdm.id_deal, sdm.id_deal,
sdm.quantity, sdm.quantity,
sdm.unit_amount, sdm.unit_amount,

View file

@ -510,10 +510,15 @@ models:
data_type: date data_type: date
description: "The date of the transaction in UTC." description: "The date of the transaction in UTC."
- name: id_contact
data_type: text
description: "Unique identifier of the contact associated with the transaction."
- name: id_deal - name: id_deal
data_type: text data_type: text
description: | description: |
"Unique identifier of an account associated with the transaction." "Unique identifier of an account associated with the transaction.
Can be null."
- name: quantity - name: quantity
data_type: numeric data_type: numeric

View file

@ -26,7 +26,7 @@ models:
- name: reference - name: reference
data_type: character varying data_type: character varying
description: | description: |
The Superhog-set reference for the invoices. Only relevant for The Truvi-set reference for the invoices. Only relevant for
records of invoice type (ACCREC). records of invoice type (ACCREC).
- name: invoice_number - name: invoice_number
@ -61,8 +61,8 @@ models:
- name: invoice_type - name: invoice_type
data_type: character varying data_type: character varying
description: | description: |
This field indicates whether the invoice is from Superhog towards a customer This field indicates whether the invoice is from Truvi towards a customer
(value is "ACCREC") or from a supplier towards Superhog (value is "ACCPAY"). (value is "ACCREC") or from a supplier towards Truvi (value is "ACCPAY").
- name: invoice_currency_iso_4217 - name: invoice_currency_iso_4217
data_type: character varying data_type: character varying
@ -299,7 +299,7 @@ models:
- name: account_number - name: account_number
data_type: character varying data_type: character varying
description: A Superhog set identifier. For customers, this is Hubspot's Deal Id. description: A Truvi set identifier. For customers, this is Hubspot's Deal Id.
- name: id_deal - name: id_deal
data_type: text data_type: text
@ -316,11 +316,11 @@ models:
- name: is_customer - name: is_customer
data_type: boolean data_type: boolean
description: Flag that shows if the contact is a Superhog customer. description: Flag that shows if the contact is a Truvi customer.
- name: is_supplier - name: is_supplier
data_type: boolean data_type: boolean
description: Flag that shows if the contact is a Superhog supplier. description: Flag that shows if the contact is a Truvi supplier.
- name: tax_number - name: tax_number
data_type: character varying data_type: character varying
@ -496,7 +496,7 @@ models:
- name: reference - name: reference
data_type: character varying data_type: character varying
description: | description: |
The Superhog-set reference for the credit note. The Truvi-set reference for the credit note.
- name: credit_note_number - name: credit_note_number
data_type: character varying data_type: character varying
@ -1580,3 +1580,144 @@ models:
description: | description: |
"Year-to-date (YTD) total of sales amount without taxes (GBP) from the start of the previous fiscal "Year-to-date (YTD) total of sales amount without taxes (GBP) from the start of the previous fiscal
year up to the same month." year up to the same month."
- name: 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_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_xero__sales_denom_mart` model.
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."
data_tests:
- not_null
- name: account_code
data_type: text
description: "The code of the account associated with the transaction."
data_tests:
- not_null
- name: account_name
data_type: text
description: "The name of the account associated with the transaction."
data_tests:
- not_null
- name: line_description
data_type: text
description: "Description of the transaction line item."
- name: document_class
data_type: text
description: "Indicates whether the record belongs in an a credit note or a bank transaction."
data_tests:
- not_null
- accepted_values:
values:
- "credit note"
- "bank transaction"
- name: transaction_date_utc
data_type: date
description: "The date of the transaction in UTC."
- name: quantity
data_type: numeric
description: "The quantity of transactions."
- name: unit_amount
data_type: numeric
description: "The unit amount of the transaction."
- name: line_amount_local_curr
data_type: numeric
description: "The transaction amount in the local currency."
- name: line_amount_in_gbp
data_type: numeric
description: "The transaction amount in GBP."
- name: line_amount_wo_taxes_local_curr
data_type: numeric
description: "The transaction amount without taxes in the local currency."
- name: line_amount_wo_taxes_in_gbp
data_type: numeric
description: "The transaction amount without taxes in GBP."
- name: tax_amount_local_curr
data_type: numeric
description: "The tax amount in the local currency."
- name: tax_amount_in_gbp
data_type: numeric
description: "The tax amount in GBP."
- name: transaction_currency_iso_4217
data_type: character varying
description: "The currency of the transaction, represented in ISO 4217 format."
- name: id_contact
data_type: text
description: "Unique identifier of the contact associated with the transaction."
date_tests:
- not_null
- name: id_deal
data_type: text
description: |
"Unique identifier of an account associated with the transaction.
Can be null"
- name: account_number
data_type: character varying
description: A Truvi set identifier. For customers, this is Hubspot's Deal Id.
- name: contact_name
data_type: character varying
description: The name for the customer.
- name: is_customer
data_type: boolean
description: Flag that shows if the contact is a Truvi customer.
- name: is_supplier
data_type: boolean
description: Flag that shows if the contact is a Truvi supplier.
- name: contact_first_name
data_type: character varying
description: ""
- name: contact_last_name
data_type: character varying
description: ""
- name: email_addresses
data_type: character varying
description: ""
- name: contact_number
data_type: character varying
description: ""
- name: contact_status
data_type: character varying
description: ""

View file

@ -0,0 +1,35 @@
with
int_xero__host_resolutions_payments as (
select * from {{ ref("int_xero__host_resolutions_payments") }}
),
xero__contacts as (select * from {{ ref("xero__contacts") }})
select
hrp.id_line_item,
hrp.document_class,
hrp.id_account,
hrp.account_code,
hrp.account_name,
hrp.line_description,
hrp.transaction_date_utc,
hrp.quantity,
hrp.unit_amount,
hrp.line_amount_local_curr,
hrp.line_amount_in_gbp,
hrp.line_amount_wo_taxes_local_curr,
hrp.line_amount_wo_taxes_in_gbp,
hrp.tax_amount_local_curr,
hrp.tax_amount_in_gbp,
hrp.transaction_currency_iso_4217,
hrp.id_contact,
hrp.id_deal,
c.account_number,
c.contact_name,
c.is_customer,
c.is_supplier,
c.contact_first_name,
c.contact_last_name,
c.email_addresses,
c.contact_number,
c.contact_status
from int_xero__host_resolutions_payments hrp
left join xero__contacts c on c.id_contact = hrp.id_contact