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 4, 2024
1 parent b9f9b8d commit 57b90f0
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()

Check warning on line 1234 in l10n_br_nfe/models/document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_nfe/models/document.py#L1234

Added line #L1234 was not covered by tests

for record in self.filtered(lambda d: d.document_type == MODELO_FISCAL_NFCE):
record.nfe40_infNFeSupl = self.env[

Check warning on line 1237 in l10n_br_nfe/models/document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_nfe/models/document.py#L1237

Added line #L1237 was not covered by tests
"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 57b90f0

Please sign in to comment.