Skip to content

Commit

Permalink
[RFC] l10n_br_nfe: refactor infNFeSupl creation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Dec 2, 2024
1 parent d4d1608 commit 69115ec
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,12 +1227,19 @@ 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(),
}
)

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

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

def _eletronic_document_send(self):
super()._eletronic_document_send()
Expand Down

0 comments on commit 69115ec

Please sign in to comment.