Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] l10n_br_fiscal_edi: add _document_qrcode() on _exec_before_SITUACAO_EDOC_A_ENVIAR method #3508

Open
wants to merge 2 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l10n_br_fiscal_edi/models/document_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def _exec_before_SITUACAO_EDOC_A_ENVIAR(self, old_state, new_state):
self._document_number()
self._document_comment()
self._document_check()
self._document_qrcode()
self._document_export()
return True

Expand Down
27 changes: 15 additions & 12 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,14 +1226,23 @@ def _is_nfe_found(c_stat):

def _prepare_nfce_send(self):
self.ensure_one()
self._prepare_payments_for_nfce()
self.nfe40_infNFeSupl = self.env["l10n_br_fiscal.document.supplement"].create(
{
"nfe40_qrCode": self.get_nfce_qrcode(),
"nfe40_urlChave": self.get_nfce_qrcode_url(),
}
self.nfe40_detPag.filtered(lambda p: p.nfe40_tPag == "99").write(
{"nfe40_xPag": "Outros"}
)

def _document_qrcode(self):
super()._document_qrcode()

for record in self.filtered(lambda d: d.document_type == MODELO_FISCAL_NFCE):
record.nfe40_infNFeSupl = self.env[
"l10n_br_fiscal.document.supplement"
].create(
{
"qrcode": record.get_nfce_qrcode(),
"url_key": record.get_nfce_qrcode_url(),
}
)

def _eletronic_document_send(self):
super()._eletronic_document_send()
for record in self.filtered(filter_processador_edoc_nfe):
Expand Down Expand Up @@ -1528,12 +1537,6 @@ def get_nfce_qrcode_url(self):

return self._edoc_processor().consulta_qrcode_url

def _prepare_payments_for_nfce(self):
for rec in self.filtered(lambda d: d.document_type == MODELO_FISCAL_NFCE):
rec.nfe40_detPag.filtered(lambda p: p.nfe40_tPag == "99").write(
{"nfe40_xPag": "Outros"}
)

def action_danfe_nfce_report(self):
return (
self.env["ir.actions.report"]
Expand Down
Loading