NFE-321

The rule sets below word this rule differently; each wording is shown with its rule set.

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.

Message

Rejeição: NF-e de devolução de mercadoria não possui documento fiscal referenciado.

Context
nfe:infNFe
Test
$fin != '4' or $refs or $det/nfe:DFeReferenciado or $cfops = ('1201', '1202', '1410', '1411', '5921', '6921')

Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol

Message

Rejeição: NF-e de devolução de mercadoria não possui documento fiscal referenciado a nível de item (DFeReferenciado/chaveAcesso, obrigatório a partir de …).

Context
nfe:infNFe
Test
not($fin = '4' and exists($emitted) and $emitted ge $later) or (every $d in $det satisfies $d/nfe:DFeReferenciado/nfe:chaveAcesso)

Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol