Commit 7aae75f2 authored by agb80's avatar agb80

style(pylint): corrige algunos de los errores reportados por pylint

parent 28cb9a66
......@@ -27,7 +27,7 @@
<field name="name">account.tax.group.view.tree</field>
<field name="model">account.tax.group</field>
<field name="arch" type="xml">
<tree string="Groups">
<tree>
<field name="name" />
<field name="code" />
</tree>
......@@ -38,7 +38,7 @@
<field name="name">account.tax.group.view.search</field>
<field name="model">account.tax.group</field>
<field name="arch" type="xml">
<search string="Groups">
<search>
<field name="name"/>
<field name="code"/>
</search>
......
......@@ -41,7 +41,7 @@
<field name="name">res.company.facturae.certificate.view.tree</field>
<field name="model">res.company.facturae.certificate</field>
<field name="arch" type="xml">
<tree string="Certificates">
<tree>
<field name="serial_number"/>
<field name="date_start"/>
<field name="date_end"/>
......
......@@ -255,7 +255,7 @@ class IrAttachmentFacturaeMx(models.Model):
domain = [("model", "=", self.type_attachment)]
config = ir_attachment_config_obj.search(domain, limit=1)
if self.cfdi_type == "incoming" and not len(config):
if self.cfdi_type == "incoming" and not config:
raise UserError(
_("You do not have any defined template " "for {model} model").format(
model=self.type_attachment
......@@ -387,18 +387,22 @@ class IrAttachmentFacturaeMx(models.Model):
:return fecha: datetime value of tag found
:rtype fecha: Datetime
"""
res = ""
if not self.env.user.partner_id.tz:
raise UserError(_("Set your time zone"))
user_tz = timezone(self.env.user.partner_id.tz)
try:
fecha = parse(self._parse_xml(tag))
except AttributeError as e:
_logger.debug(e)
fecha = None
if fecha:
user_tz = timezone(self.env.user.partner_id.tz)
pass
else:
fecha = user_tz.localize(fecha)
fecha = fecha.astimezone(utc)
return fields.Datetime.to_string(fecha)
res = fields.Datetime.to_string(fecha)
return res
@property
def hash_type(self):
......@@ -728,7 +732,7 @@ class IrAttachmentFacturaeMx(models.Model):
"""
namespaces = namespaces or NAMESPACES
if not data:
return
return ""
root = parse_xml_string(data)
complete_pattern = "".join([".//", element, "[@", attrib, "]"])
result = root.find(complete_pattern, namespaces=namespaces)
......
......@@ -50,7 +50,7 @@
<field name="name">ir.attachment.facturae.view.tree</field>
<field name="model">ir.attachment.facturae.mx</field>
<field name="arch" type="xml">
<tree string="CFDI">
<tree>
<field name="name"/>
<field name="cfdi_type"/>
<field name="state"/>
......
......@@ -6,7 +6,7 @@
<field name="name">ir.attachment.facturae.config.view.tree</field>
<field name="model">ir.attachment.facturae.mx.config</field>
<field name="arch" type="xml">
<tree string="CFDI Documments">
<tree>
<field name="model"/>
<field name="version"/>
<field name="template_xml_sign"/>
......
......@@ -27,7 +27,7 @@ class ParamsPac(models.Model):
return {}
@classmethod
def get_driver_fc_status(self):
def get_driver_fc_status(cls):
"""function to inherit from custom PAC module"""
return {}
......@@ -189,7 +189,7 @@ class ParamsPac(models.Model):
:type uuid: string
"""
self.check_pacs()
_logger.info("Consulting status for uuid: %s" % uuid)
_logger.info("Consulting status for uuid: %s", uuid)
result = self.fire_connection(uuid, "get_driver_fc_status")
return result
......
......@@ -221,7 +221,7 @@ class ParamsPac(models.Model):
res = client.service.get_sat_status(
username, password, emisor, receptor, uuid, total
)
_logger.debug("Finkok answer for cfdi status: %s" % res)
_logger.debug("Finkok answer for cfdi status: %s", res)
folio = res.sat
estatus_cancelacion = folio["EstatusCancelacion"] or ""
estado_cfdi = folio["Estado"]
......
......@@ -174,12 +174,14 @@ class ParamsPac(models.Model):
resultado = wsdl_client.timbrar(*params)
mensaje = _(tools.ustr(resultado["mensaje"]))
resultados_mensaje = (
resultado["resultados"] and resultado["resultados"]["mensaje"] or ""
resultado["resultados"]["mensaje"] if resultado["resultados"] else ""
)
folio_fiscal = (
resultado["resultados"]["uuid"] if resultado["resultados"] else ""
)
folio_fiscal = resultado["resultados"] and resultado["resultados"]["uuid"] or ""
codigo_timbrado = resultado["status"] or ""
codigo_validacion = (
resultado["resultados"] and resultado["resultados"]["status"] or ""
resultado["resultados"]["status"] if resultado["resultados"] else ""
)
if codigo_timbrado in ["311", "312"]:
raise pac_exceptions.PrimarySectorError(code=resultado["codigo"])
......@@ -187,15 +189,14 @@ class ParamsPac(models.Model):
codigo_timbrado == "200"
and codigo_validacion == "200"
or codigo_validacion == "307"
): # noqa
):
fecha_timbrado = resultado["resultados"]["fechaTimbrado"] or False
fecha_timbrado = (
fecha_timbrado
and time.strftime(
time.strftime(
"%Y-%m-%d %H:%M:%S",
time.strptime(fecha_timbrado[:19], "%Y-%m-%dT%H:%M:%S"),
)
or False
if fecha_timbrado else False
)
cfdi_data = {
"cfdi_xml": base64.decodestring(
......
......@@ -49,7 +49,7 @@
<field name="name">view.params.pac.tree</field>
<field name="model">params.pac</field>
<field name="arch" type="xml">
<tree string="Parameters PAC">
<tree>
<field name="sequence" widget="handle"/>
<field name="pac_type" />
<field name="user" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment