more schema, more tests

This commit is contained in:
Pablo Martin 2024-07-08 17:26:10 +02:00
parent 003c7cd185
commit 00b7940c25

View file

@ -44,6 +44,8 @@ models:
across both is that credit note amounts get their sign reversed (* -1) so
that aggregations happen naturally (credit amounts subtract from invoice
amounts). The final granularity of the table is on the line item level.
Invoice and credit note records can be told apart through the
document_class field.
The word _document_ in the context of this table encompasses both invoices
and credit notes.
@ -53,6 +55,9 @@ models:
document level data. Aggregating line fields can be done without worries.
Document level data can't be summed or averaged since it's duplicated per
line item, so be careful with it.
Fields are not documented here: you can find more details in upstream
models.
columns:
- name: id_line_item
@ -68,7 +73,14 @@ models:
- name: document_class
data_type: text
description: ""
description: |
Indicates whether the record belongs in an invoice or a credit note.
tests:
- not_null
- accepted_values:
values:
- 'invoice'
- 'credit note'
- name: item_code
data_type: text
@ -110,9 +122,14 @@ models:
data_type: text
description: ""
- name: invoice_currency_iso_4217
- name: document_currency_iso_4217
data_type: character varying
description: ""
tests:
- not_null
- length_between:
min_length: 3
max_length: 3
- name: line_description
data_type: text
@ -121,6 +138,8 @@ models:
- name: id_document
data_type: character varying
description: ""
tests:
- not_null
- name: reference
data_type: character varying
@ -141,6 +160,14 @@ models:
- name: document_type
data_type: character varying
description: ""
tests:
- not_null
- accepted_values:
values:
- "ACCREC"
- "ACCPAY"
- "ACCRECCREDIT"
- "ACCPAYCREDIT"
- name: document_currency_iso_4217
data_type: character varying
@ -149,14 +176,33 @@ models:
- name: exchange_rate_to_gbp
data_type: numeric
description: ""
tests:
- not_null
- not_negative
- name: document_status
data_type: character varying
description: ""
tests:
- not_null
- accepted_values:
values:
- PAID
- VOIDED
- DRAFT
- DELETED
- AUTHORISED
- SUBMITTED
- name: line_amount_tax_inclusiveness
data_type: character varying
description: ""
tests:
- accepted_values:
values:
- Inclusive
- Exclusive
- NoTax
- name: header_total_amount_local_curr
data_type: numeric