[16.0][FIX] l10n_br_fiscal_edi: prevent recursive loop in action_document_confirm #4364
+69
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resumo
Corrige um bug onde confirmar uma fatura de entrada (issuer=partner) pela view do documento fiscal falhava com o erro:
Como reproduzir
in_invoice) com um tipo de documento fiscal (ex: NF-e)issuer=partner(padrão para faturas de entrada)l10n_br_fiscal.document)Causa raiz
Ao confirmar pela view do documento fiscal:
action_document_confirm()é chamado → documento vai paraautorizada(quando issuer=partner)move_ids._post()para postar a fatura vinculada_post()chamaaction_document_confirm()novamente no documento fiscalautorizadaparaautorizada→ erroSolução
Alterado o filtro em
_document_confirm_to_send()para processar apenas documentos no estadoem_digitacao, tornando o método idempotente e seguro para ser chamado múltiplas vezes.Obs: Confirmar pela view da fatura (
account.move) funciona corretamente porque a flag de contextoskip_postprevine a chamada recursiva.