diff --git a/l10n_br_account_nfe/models/document.py b/l10n_br_account_nfe/models/document.py index 2e5a70ca15b7..9f934c55fb10 100644 --- a/l10n_br_account_nfe/models/document.py +++ b/l10n_br_account_nfe/models/document.py @@ -162,5 +162,7 @@ def _update_nfce_for_offline_contingency(self): res = super()._update_nfce_for_offline_contingency() if self.move_ids: copy_invoice = self.move_ids[0].copy() + copy_invoice.fiscal_document_id.processador_edoc = self.processador_edoc + copy_invoice.fiscal_document_id.nfe_transmission = self.nfe_transmission copy_invoice.action_post() return res diff --git a/l10n_br_account_nfe/tests/test_nfce_contingency.py b/l10n_br_account_nfe/tests/test_nfce_contingency.py index 6333f5710dc6..7322c06dc93e 100644 --- a/l10n_br_account_nfe/tests/test_nfce_contingency.py +++ b/l10n_br_account_nfe/tests/test_nfce_contingency.py @@ -1,6 +1,7 @@ # Copyright 2023 KMEE (Felipe Zago Rodrigues ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields from odoo.tests import TransactionCase @@ -54,8 +55,24 @@ def prepare_account_move_nfce(self): "payment_mode_id": payment_mode.id, "company_id": self.env.ref("base.main_company").id, "line_ids": [ - (0, 0, {"account_id": receivable_account_id.id, "credit": 10}), - (0, 0, {"account_id": payable_account_id.id, "debit": 10}), + ( + 0, + 0, + { + "date_maturity": fields.Date.today(), + "account_id": receivable_account_id.id, + "credit": 10, + }, + ), + ( + 0, + 0, + { + "date_maturity": fields.Date.today(), + "account_id": payable_account_id.id, + "debit": 10, + }, + ), ], } ) diff --git a/l10n_br_nfe/models/document.py b/l10n_br_nfe/models/document.py index 977cd5970c7b..c58f730d931d 100644 --- a/l10n_br_nfe/models/document.py +++ b/l10n_br_nfe/models/document.py @@ -1528,6 +1528,8 @@ def get_nfce_qrcode(self): processador = self._edoc_processor() if self.nfe_transmission == "1": return processador.monta_qrcode(self.document_key) + if not self.serialize() or not len(self.serialize()): + return serialized_doc = self.serialize()[0] xml = processador.assina_raiz(serialized_doc, serialized_doc.infNFe.Id) @@ -1536,6 +1538,8 @@ def get_nfce_qrcode(self): def get_nfce_qrcode_url(self): if self.document_type != MODELO_FISCAL_NFCE: return + if self._edoc_processor() is None: + return return self._edoc_processor().consulta_qrcode_url