BR-FR-MV-14-EXT-FR-FE-138

BR-FR-MV-14-EXT-FR-FE-138 : Date Facture antérieure manquant ligne … : Lorsque le cadre de facturation (BT-23) est S8, B8 ou M8, et pour les factures rectificatives et avoirs chaque ligne (BG-25) avec un sous-type de ligne (EXT-FR-FE-163) égal à "GROUP" et sans identifiant de ligne Parent (EXT-FR-FE-162) doit comprendre un identifiant de facture antérieure à la ligne (EXT-FR-FE-136) ainsi que sa date (EXT-FR-FE-138).

In English When the billing mode (BT-23) is S8, B8 or M8, every GROUP line without a parent (EXT-FR-FE-163, EXT-FR-FE-162) of a corrective invoice or credit note must have a preceding invoice reference (EXT-FR-FE-136) and its date (EXT-FR-FE-138).

error: the document is invalid

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element

Context
(ubl:Invoice | cn:CreditNote)[(cbc:InvoiceTypeCode | cbc:CreditNoteTypeCode) = ('384','472','381','396','503')]/(cac:InvoiceLine | cac:CreditNoteLine)/cac:BillingReference[cac:InvoiceDocumentReference/cbc:ID = $invoiceID][(cac:InvoiceDocumentReference/cbc:DocumentStatusCode = 'GROUP') and not(cac:BillingReferenceLine/cbc:ID)]
Test
not(custom:isSpecialContractMV(/ubl:Invoice|/cn:CreditNote)) or exists(../cac:BillingReference[cac:InvoiceDocumentReference/cbc:ID != $invoiceID]/cac:InvoiceDocumentReference/cbc:IssueDate)

Checked with France e-invoice (UBL), France e-credit note (UBL), France EXTENDED-CTC-FR (UBL)

Context
rsm:CrossIndustryInvoice[rsm:ExchangedDocument/ram:TypeCode = ('384','472','381','396','503')]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem[ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' and not(ram:AssociatedDocumentLineDocument/ram:ParentLineID)]
Test
not(custom:isSpecialContractMV(/rsm:CrossIndustryInvoice)) or exists(ram:SpecifiedLineTradeSettlement/ram:InvoiceReferencedDocument/ram:FormattedIssueDateTime/qdt:DateTimeString)

Checked with France e-invoice (CII), France Factur-X EN 16931, France EXTENDED-CTC-FR (CII), France Factur-X EXTENDED, France Factur-X BASIC WL