Merged PR 4568: Adds flag to identify invoices/credit notes that are posted in Hyperline
# Description Adds flag to identify invoices/credit notes that are posted in Hyperline. For Invoices, these need to be ACCREC and follow a convention of 20XX-Y For Credit Notes, these need to be ACCRECCREDIT and follow a convention of CN-20XX-Y # 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. Related work items: #28146
This commit is contained in:
parent
2a0172edd5
commit
dcf0f205a2
8 changed files with 86 additions and 0 deletions
|
|
@ -37,5 +37,10 @@ select
|
|||
was_fully_paid_on_date_utc,
|
||||
line_amount_tax_inclusiveness,
|
||||
updated_date_utc,
|
||||
case
|
||||
when credit_note_number ~ '^CN-20\d{2}-.*' and credit_note_type = 'ACCRECCREDIT'
|
||||
then true
|
||||
else false
|
||||
end as is_credit_note_posted_in_hyperline,
|
||||
dwh_extracted_at_utc
|
||||
from stg_xero__credit_notes
|
||||
|
|
|
|||
|
|
@ -48,5 +48,10 @@ select
|
|||
line_amount_tax_inclusiveness,
|
||||
payment_planned_date_utc,
|
||||
payment_expected_date_utc,
|
||||
case
|
||||
when invoice_number ~ '^20\d{2}-.*' and invoice_type = 'ACCREC'
|
||||
then true
|
||||
else false
|
||||
end as is_invoice_posted_in_hyperline,
|
||||
dwh_extracted_at_utc
|
||||
from stg_xero__invoices
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ select
|
|||
ili.line_description as line_description,
|
||||
|
||||
i.id_invoice as id_document,
|
||||
i.is_invoice_posted_in_hyperline as is_document_posted_in_hyperline,
|
||||
i.reference as reference,
|
||||
i.invoice_number as document_number,
|
||||
i.invoice_issued_at_utc as document_issued_at_utc,
|
||||
|
|
@ -89,6 +90,7 @@ select
|
|||
cnli.line_description,
|
||||
|
||||
cn.id_credit_note,
|
||||
cn.is_credit_note_posted_in_hyperline as is_document_posted_in_hyperline,
|
||||
cn.reference,
|
||||
cn.credit_note_number,
|
||||
cn.credit_note_issued_at_utc,
|
||||
|
|
|
|||
|
|
@ -7,12 +7,33 @@ models:
|
|||
data_tests:
|
||||
- not_null
|
||||
- unique
|
||||
- name: is_invoice_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the invoice has been posted in Hyperline.
|
||||
An invoice is considered posted in Hyperline if it has an
|
||||
invoice type equal to ACCREC and follows the naming convention
|
||||
20XX-Y, where 20XX is the posting year and Y is an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: int_xero__credit_notes
|
||||
columns:
|
||||
- name: id_credit_note
|
||||
data_tests:
|
||||
- not_null
|
||||
- unique
|
||||
- name: is_credit_note_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the credit note has been posted in Hyperline.
|
||||
A credit note is considered posted in Hyperline if it has a
|
||||
credit note type equal to ACCRECCREDIT and follows the naming convention
|
||||
CN-20XX-Y, where CN refers to Credit Note, 20XX is the posting year and
|
||||
Y is an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: int_xero__invoice_line_items
|
||||
columns:
|
||||
- name: id_line_item
|
||||
|
|
@ -153,6 +174,20 @@ models:
|
|||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: is_document_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the document has been posted in Hyperline.
|
||||
A document is considered posted in Hyperline if it follows this logic:
|
||||
- For invoices, if the invoice type equals to ACCREC and the document number
|
||||
follows the naming convention 20XX-Y, where 20XX is the posting year and Y is
|
||||
an autoincremental number.
|
||||
- For credit notes, if the credit note type equal to ACCRECCREDIT and the
|
||||
document number follows the naming convention CN-20XX-Y, where CN refers to
|
||||
Credit Note, 20XX is the posting year and Y is an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: reference
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
|
|
|||
|
|
@ -33,6 +33,17 @@ models:
|
|||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: is_invoice_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the invoice has been posted in Hyperline.
|
||||
An invoice is considered posted in Hyperline if it follows this logic:
|
||||
- The invoice type equals to ACCREC and the document number follows the
|
||||
naming convention 20XX-Y, where 20XX is the posting year and Y is
|
||||
an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: invoice_issued_date_utc
|
||||
data_type: timestamp with time zone
|
||||
description: Date on which the invoice was issued.
|
||||
|
|
@ -491,6 +502,17 @@ models:
|
|||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: is_credit_note_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the credit note has been posted in Hyperline.
|
||||
A credit note is considered posted in Hyperline if it follows this logic:
|
||||
- The credit note type equals to ACCRECCREDIT and the document number
|
||||
follows the naming convention CN-20XX-Y, where CN refers to Credit Note,
|
||||
20XX is the posting year and Y is an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: credit_note_issued_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: Date on which the credit note was issued.
|
||||
|
|
@ -1258,6 +1280,20 @@ models:
|
|||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: is_document_posted_in_hyperline
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates whether the document has been posted in Hyperline.
|
||||
A document is considered posted in Hyperline if it follows this logic:
|
||||
- For invoices, if the invoice type equals to ACCREC and the document number
|
||||
follows the naming convention 20XX-Y, where 20XX is the posting year and Y is
|
||||
an autoincremental number.
|
||||
- For credit notes, if the credit note type equal to ACCRECCREDIT and the
|
||||
document number follows the naming convention CN-20XX-Y, where CN refers to
|
||||
Credit Note, 20XX is the posting year and Y is an autoincremental number.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: reference
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ select
|
|||
id_contact as id_contact,
|
||||
reference as reference,
|
||||
credit_note_number as credit_note_number,
|
||||
is_credit_note_posted_in_hyperline as is_credit_note_posted_in_hyperline,
|
||||
credit_note_issued_at_utc as credit_note_issued_at_utc,
|
||||
credit_note_issued_date_utc as credit_note_issued_date_utc,
|
||||
credit_note_type as credit_note_type,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ select
|
|||
id_contact as id_contact,
|
||||
reference as reference,
|
||||
invoice_number as invoice_number,
|
||||
is_invoice_posted_in_hyperline as is_invoice_posted_in_hyperline,
|
||||
invoice_issued_at_utc as invoice_issued_at_utc,
|
||||
invoice_issued_date_utc as invoice_issued_date_utc,
|
||||
invoice_due_date_utc as invoice_due_date_utc,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ select
|
|||
sdm.tax_type as tax_type,
|
||||
sdm.line_description as line_description,
|
||||
sdm.id_document as id_document,
|
||||
sdm.is_document_posted_in_hyperline as is_document_posted_in_hyperline,
|
||||
sdm.reference as reference,
|
||||
sdm.document_number as document_number,
|
||||
sdm.document_issued_at_utc as document_issued_at_utc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue