Skip to content

Commit

Permalink
[RFC] l10n_br_nfe: refactor nfce qrcode methods
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Dec 5, 2024
1 parent 85e3e82 commit cbd2e6f
Showing 1 changed file with 15 additions and 12 deletions.
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

0 comments on commit cbd2e6f

Please sign in to comment.