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

[ADD] l10n_mx_hr_payroll_edi #53

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions l10n_mx_hr_payroll_edi/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EDI for Mexican Payroll Localization
====================================

Allow the user to generate the EDI document for Mexican invoicing.

This module allows the creation of the EDI documents and the communication with the Mexican certification providers (PACs) to sign/cancel them.
1 change: 1 addition & 0 deletions l10n_mx_hr_payroll_edi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
31 changes: 31 additions & 0 deletions l10n_mx_hr_payroll_edi/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Payroll EDI for Mexico",
"icon": "/l10n_mx/static/description/icon.png",
"summary": "Mexican Localization for Payroll EDI documents",
"author": "e-maanu, "
"Open Source Integrators, "
"Asociacion Mexicana de Odoo (AMOdoo), "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-mexico",
"category": "Human Resources/Payroll",
"version": "17.0.1.0.0",
"depends": [
"l10n_mx_edi_40",
"l10n_mx_hr_payroll",
],
"external_dependencies": {
"python": ["pyOpenSSL", "zeep"],
},
"data": [
"data/1.2/cfdi.xml",
"security/ir.model.access.csv",
"views/res_config_settings.xml",
"views/hr_payslip.xml",
"data/account_edi_data.xml",
],
"demo": [],
"installable": True,
"application": False,
"license": "LGPL-3",
"development_status": "Beta",
}
351 changes: 351 additions & 0 deletions l10n_mx_hr_payroll_edi/data/1.2/cadenaoriginal.xslt

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions l10n_mx_hr_payroll_edi/data/1.2/cadenaoriginal_TFD_1_1.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital">
<!-- Con el siguiente método se establece que la salida deberá ser en texto -->
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:template name="Requerido">
<xsl:param name="valor"/>|<xsl:call-template name="ManejaEspacios">
<xsl:with-param name="s" select="$valor"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="Opcional">
<xsl:param name="valor"/>
<xsl:if test="$valor">|<xsl:call-template name="ManejaEspacios"><xsl:with-param name="s" select="$valor"/></xsl:call-template></xsl:if>
</xsl:template>
<!-- Normalizador de espacios en blanco -->
<xsl:template name="ManejaEspacios">
<xsl:param name="s"/>
<xsl:value-of select="normalize-space(string($s))"/>
</xsl:template>
<!-- Aquí iniciamos el procesamiento de la cadena original con su | inicial y el terminador || -->
<xsl:template match="/">|<xsl:apply-templates select="/tfd:TimbreFiscalDigital"/>||</xsl:template>
<!-- Aquí iniciamos el procesamiento de los datos incluidos en el comprobante -->
<xsl:template match="tfd:TimbreFiscalDigital">
<!-- Iniciamos el tratamiento de los atributos del Timbre-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UUID"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@FechaTimbrado"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RfcProvCertif"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Leyenda"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SelloCFD"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NoCertificadoSAT"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
146 changes: 146 additions & 0 deletions l10n_mx_hr_payroll_edi/data/1.2/cfdi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="cfdiv12">
<cfdi:Comprobante
xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd"
xmlns:cfdi="http://www.sat.gob.mx/cfd/4"
xmlns:nomina12='http://www.sat.gob.mx/nomina12'
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Version="4.0"
t-att-Fecha="cfdi_date"
t-att-Folio="format_string(folio_number, 40)"
t-att-Serie="format_string(serie_number, 25)"
t-att-NoCertificado="certificate_number"
t-att-Certificado="certificate_key"
t-att-SubTotal="format_float(total_allowance_amount, currency_precision)"
t-att-Descuento="format_float(total_deduction_amount, currency_precision)"
t-att-Moneda="currency_name"
t-att-TipoCambio="format_float(currency_conversion_rate, 6)"
t-att-Total="format_float(total_cfdi, currency_precision)"
TipoDeComprobante="N"
Exportacion="01"
MetodoPago="PUE"
t-att-LugarExpedicion="issued_address.zip or supplier.zip"
>
<t t-if="origin_uuids">
<cfdi:CfdiRelacionados t-att-TipoRelacion="origin_type">
<t t-foreach="origin_uuids" t-as="uuid">
<cfdi:CfdiRelacionado t-att-UUID="uuid" />
</t>
</cfdi:CfdiRelacionados>
</t>
<cfdi:Emisor
t-att-Rfc="supplier.vat"
t-att-Nombre="format_string(supplier.name, 254)"
t-att-RegimenFiscal="record.company_id.l10n_mx_edi_fiscal_regime"
/>
<cfdi:Receptor
t-att-Rfc="customer_rfc"
t-att-Nombre="format_string(customer.commercial_partner_id.name, 254)"
DomicilioFiscalReceptor="36257"
RegimenFiscalReceptor="605"
UsoCFDI="CN01"
/>
<cfdi:Conceptos>
<cfdi:Concepto
ClaveProdServ="84111505"
Cantidad="1"
ClaveUnidad="ACT"
Descripcion="Pago de nómina"
t-att-ValorUnitario="format_float(total_allowance_amount, currency_precision)"
t-att-Importe="format_float(total_allowance_amount, currency_precision)"
t-att-Descuento="format_float(total_deduction_amount, currency_precision)"
ObjetoImp="01"
/>
</cfdi:Conceptos>
<cfdi:Complemento>
<nomina12:Nomina
Version="1.2"
t-att-FechaPago="(record.payment_day)"
t-att-FechaInicialPago="(record.date_from)"
t-att-Sindicalizado="Sí if employee.syndicated else No"
t-att-FechaFinalPago="(record.date_to)"
NumDiasPagados="7"
t-att-TipoNomina="tiponomina"
t-att-TotalDeducciones="format_float(total_deduction_amount, currency_precision)"
t-att-TotalOtrosPagos="format_float(total_others_amount, currency_precision)"
t-att-TotalPercepciones="format_float(total_allowance_amount, currency_precision)"
xsi:schemaLocation="http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/Complementoscfdi/nomina12.xsd"
>
<nomina12:Emisor
t-att-RegistroPatronal="employee.employer_register.name"
/>
<nomina12:Receptor
t-att-Curp="employee.address_home_id.curp"
t-att-TipoContrato="contract.contract_type"
t-att-TipoRegimen="employee.l10n_mx_hr_payroll_fiscal_regime"
t-att-NumEmpleado="employee.employee_number"
t-att-Antigüedad="antiguedad"
t-att-PeriodicidadPago="contract.period_cfdi.type_id.period_cfdi"
t-att-ClaveEntFed="employee.address_id.state_id.code"
t-att-NumSeguridadSocial="employee.ssnid"
t-att-FechaInicioRelLaboral="contract.first_contract_date"
t-att-Puesto="employee.department_id.name"
t-att-SalarioBaseCotApor="format_float(contract.sbc, 2)"
t-att-RiesgoPuesto="employee.employer_register.job_risk"
t-att-SalarioDiarioIntegrado="format_float(contract.sdi, 2)"
/>
<nomina12:Percepciones
t-att-TotalSueldos="format_float(total_allowance_amount, currency_precision)"
t-att-TotalGravado="format_float(total_allowance_amount, currency_precision)"
TotalExento="0.00"
>
<t
t-foreach="payslip_line_allowance_values"
t-as="line_alw"
>
<t t-set="line" t-value="line_alw['line']" />
<nomina12:Percepcion
t-att-TipoPercepcion="format_string(line.salary_rule_id.allowance_type_l10n_mx.code)"
t-att-Clave="format_string(line.salary_rule_id.code)"
t-att-Concepto="format_string(line.salary_rule_id.name)"
t-att-ImporteGravado="format_float(line.total, currency_precision)"
ImporteExento="0.00"
/>
</t>
</nomina12:Percepciones>
<nomina12:Deducciones
t-att-TotalOtrasDeducciones="format_float(TotalOtrasDeducciones, currency_precision)"
t-att-TotalImpuestosRetenidos="format_float(TotalImpuestosRetenidos, currency_precision)"
>
<t
t-foreach="payslip_line_deduction_values"
t-as="line_ded"
>
<t t-set="line" t-value="line_ded['line']" />
<nomina12:Deduccion
t-att-TipoDeduccion="format_string(line.salary_rule_id.deduction_type_l10n_mx.code)"
t-att-Clave="format_string(line.salary_rule_id.code)"
t-att-Concepto="format_string(line.salary_rule_id.name)"
t-att-Importe="format_float(line.total, currency_precision)"
/>
</t>
</nomina12:Deducciones>
<nomina12:OtrosPagos>
<t
t-foreach="payslip_line_others_values"
t-as="line_others"
>
<t t-set="line" t-value="line_others['line']" />
<nomina12:OtroPago
t-att-TipoOtroPago="format_string(line.salary_rule_id.otherpayment_type_l10n_mx.code)"
t-att-Clave="format_string(line.salary_rule_id.code)"
t-att-Concepto="format_string(line.salary_rule_id.name)"
t-att-Importe="format_float(total_others_amount, currency_precision)"
>
<nomina12:SubsidioAlEmpleo
t-att-SubsidioCausado="format_float(line.total, currency_precision)"
/>
</nomina12:OtroPago>
</t>
</nomina12:OtrosPagos>
</nomina12:Nomina>
</cfdi:Complemento>
</cfdi:Comprobante>
</template>
</odoo>
Loading
Loading