Skip to content

Commit

Permalink
[REF] l10n_br_nfe: lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Jul 20, 2024
1 parent aaa9714 commit a97c4ec
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
1 change: 0 additions & 1 deletion l10n_br_nfe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

from .hooks import post_init_hook
from . import models
from . import tests
from . import wizards
8 changes: 6 additions & 2 deletions l10n_br_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,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

Expand Down Expand Up @@ -986,7 +990,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):
Expand Down
24 changes: 14 additions & 10 deletions l10n_br_nfe/models/mde.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MDe(models.Model):

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))

Expand All @@ -44,15 +44,14 @@ class MDe(models.Model):
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(
Expand Down Expand Up @@ -84,16 +83,15 @@ class MDe(models.Model):

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,
)
Expand Down Expand Up @@ -148,7 +146,11 @@ def validate_event_response(self, result, valid_codes):

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):
Expand All @@ -161,7 +163,9 @@ def import_document(self):
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(
body=_("Error importing document: \n\n %(error)s", error=e)
)
return

if document_id:
Expand Down
1 change: 0 additions & 1 deletion l10n_br_nfe/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down
6 changes: 3 additions & 3 deletions l10n_br_nfe/wizards/import_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")

Expand Down

0 comments on commit a97c4ec

Please sign in to comment.