-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_ar_account_tax_settlement: agregar código de impuesto al i…
…nstalar el módulo. Tarea: 34379 Se agregaron los códigos de impuestos correspondientes para retenciones de ganancias aplicadas y retenciones de iva aplicadas.
- Loading branch information
1 parent
8b0d916
commit b26fcc7
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,5 @@ | |
'installable': True, | ||
'auto_install': True, | ||
'application': False, | ||
'post_init_hook': 'post_init_hook', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from odoo import api, SUPERUSER_ID | ||
import logging | ||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def post_init_hook(env): | ||
""" Al instalar este módulo (l10n_ar_account_tax_settlement), en caso de que existan compañías responsable inscripto argentinas con l10n_ar_withholding y con plan de cuentas ya establecido entonces a los impuestos de retenciones de ganancias e iva les agregamos el código de impuesto correspondiente. """ | ||
|
||
# l10n_ar_withholding es el módulo que crea los impuestos de retenciones | ||
l10n_ar_withholding = env['ir.module.module'].search([ | ||
('name', '=', 'l10n_ar_withholding'), | ||
('state', '=', 'installed'), | ||
]) | ||
if l10n_ar_withholding: | ||
# verificamos que la compañía sea argentina, responsable inscripto y tenga plan de cuentas instalado | ||
companies = env['res.company'].search([('l10n_ar_afip_responsibility_type_id.code', '=', '1'), ('chart_template', '=', 'ar_ri')]) | ||
for company in companies: | ||
# Retenciones aplicadas de ganancias | ||
xml_id_ret_gcias_aplic = "account.%s_%s" % (company.id, 'ri_tax_withholding_ganancias_applied') | ||
impuesto_ret_gcias_aplic = env.ref(xml_id_ret_gcias_aplic) | ||
if impuesto_ret_gcias_aplic: | ||
impuesto_ret_gcias_aplic.codigo_impuesto = '01' | ||
|
||
# Retenciones aplicadas de iva | ||
xml_id_ret_iva_aplic = "account.%s_%s" % (company.id, 'ri_tax_withholding_vat_applied') | ||
impuesto_ret_iva_aplic = env.ref(xml_id_ret_iva_aplic) | ||
if impuesto_ret_iva_aplic: | ||
impuesto_ret_iva_aplic.codigo_impuesto = '02' | ||
|
||
# Dejamos registro en los logs de las compañías en las cuales se estableció el código de impuesto | ||
if companies: | ||
_logger.info("Se agregaron los códigos de impuestos correspondientes para retenciones de ganancias aplicadas y retenciones de iva aplicadas para compañías %s." % ', '.join(companies.mapped('name'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters