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][l10n_br_nfe][REF] l10n_br_nfe: lint fixes #3214

Merged
merged 1 commit into from
Jul 24, 2024
Merged
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
[REF] l10n_br_nfe: lint fixes
rvalyi committed Jul 23, 2024
commit 7402ad4cbc53cf6d0792167f01d147cbb0b3dcc6
1 change: 0 additions & 1 deletion l10n_br_nfe/__init__.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,5 @@

from .hooks import post_init_hook
from . import models
from . import tests
from . import wizards
from . import report
8 changes: 6 additions & 2 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
@@ -847,7 +847,11 @@ def _document_number(self):
record.nfe40_cDV = chave.digito_verificador
except Exception as e:
raise ValidationError(
_("{}:\n {}").format(record.document_type_id.name, e)
_(
"%(name)s:\n %(error)s",
name=record.document_type_id.name,
error=e,
)
) from e
return result

@@ -1026,7 +1030,7 @@ def _exec_after_SITUACAO_EDOC_AUTORIZADA(self, old_state, new_state):
# Se der problema que apareça quando
# o usuário clicar no gerar PDF novamente.
_logger.error("DANFE Error \n {}".format(e))
super()._exec_after_SITUACAO_EDOC_AUTORIZADA(old_state, new_state)
return super()._exec_after_SITUACAO_EDOC_AUTORIZADA(old_state, new_state)

def _generate_key(self):
for record in self.filtered(filter_processador_edoc_nfe):
24 changes: 14 additions & 10 deletions l10n_br_nfe/models/mde.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@

key = fields.Char(string="Access Key", size=44)

serie = fields.Char(string="Serie", size=3, index=True)
serie = fields.Char(size=3, index=True)

number = fields.Float(string="Document Number", index=True, digits=(18, 0))

@@ -44,15 +44,14 @@
string="Fiscal Document",
)

emitter = fields.Char(string="Emitter", size=60)
emitter = fields.Char(size=60)

cnpj_cpf = fields.Char(string="CNPJ/CPF", size=18)

nsu = fields.Char(string="NSU", size=25, index=True)

operation_type = fields.Selection(
selection=OPERATION_TYPE,
string="Operation Type",
)

document_value = fields.Float(
@@ -84,16 +83,15 @@

cancellation_datetime = fields.Datetime(string="Cancellation Date", index=True)

digest_value = fields.Char(string="Digest Value", size=28)
digest_value = fields.Char(size=28)

inclusion_mode = fields.Char(string="Inclusion Mode", size=255)
inclusion_mode = fields.Char(size=255)

authorization_protocol = fields.Char(string="Authorization protocol", size=60)
authorization_protocol = fields.Char(size=60)

cancellation_protocol = fields.Char(string="Cancellation protocol", size=60)
cancellation_protocol = fields.Char(size=60)

document_state = fields.Selection(
string="Document State",
selection=SITUACAO_NFE,
index=True,
)
@@ -148,7 +146,11 @@

if not valid:
raise ValidationError(
_("Error on validating event: %s - %s" % (code, message))
_(
"Error on validating event: %(code)s - %(msg)s",
code=code,
msg=message,
)
)

def import_document(self):
@@ -161,7 +163,9 @@
document = self.dfe_id._download_document(self.key)
document_id = self.dfe_id._parse_xml_document(document)
except Exception as e:
self.dfe_id.message_post(body=_("Error importing document: \n\n %s") % e)
self.dfe_id.message_post(

Check warning on line 166 in l10n_br_nfe/models/mde.py

Codecov / codecov/patch

l10n_br_nfe/models/mde.py#L166

Added line #L166 was not covered by tests
body=_("Error importing document: \n\n %(error)s", error=e)
)
return

if document_id:
1 change: 0 additions & 1 deletion l10n_br_nfe/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -179,7 +179,6 @@ def _prepare_import_dict(
)

is_anonymous_consumer = fields.Boolean(
string="Is Anonymous Consumer",
help="Indicates that the partner is an anonymous consumer",
)

6 changes: 3 additions & 3 deletions l10n_br_nfe/wizards/import_document.py
Original file line number Diff line number Diff line change
@@ -261,7 +261,7 @@ class NfeImportProducts(models.TransientModel):
_name = "l10n_br_nfe.import_xml.products"
_description = "Import XML NFe Products"

product_name = fields.Char(string="Product Name")
product_name = fields.Char()

uom_com = fields.Char(string="UOM Comercial")

@@ -271,11 +271,11 @@ class NfeImportProducts(models.TransientModel):

uom_trib = fields.Char(string="UOM Fiscal")

quantity_trib = fields.Float(string="Fiscal Quantity")
quantity_trib = fields.Float()

price_unit_trib = fields.Float(string="Fiscal Price Unit")

total = fields.Float(string="Total")
total = fields.Float()

import_xml_id = fields.Many2one(comodel_name="l10n_br_nfe.import_xml")