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][RFC] l10n_br_nfe: refactor nfce qrcode methods #3522

Draft
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Draft
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
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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ao reconfirmar o documento isso não será gerado em duplicidade?

Copy link
Member Author

@marcelsavegnago marcelsavegnago Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estava pensando nisso esses dias tbm.. nao tem nenhuma checagem se ja existe algum registro, pelo que vi, simplesmente eh criado outro registro.. ou seja, provavelmente tem registro perdido nesta tabela.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mileo se teu time puder entrar no assunto, pode matar esta PR e criar outra.. ou manda os commits pra mim e eu mesclo.. criei ela apenas para nao deixar este assunto perdido.

{
"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