From e7137163a45b5dcb603c515ec44dbe561987d5a6 Mon Sep 17 00:00:00 2001 From: Ignacio Cainelli Date: Fri, 5 May 2023 19:12:57 +0000 Subject: [PATCH] Se quita el tag data y se agrega el binding_model closes ingadhoc/odoo-argentina-ee#200 closes ingadhoc/odoo-argentina-ee#203 Signed-off-by: Nicolas Mac Rouillon --- .../wizards/checks_to_date_view.xml | 3 +- .../__manifest__.py | 2 +- .../models/account_journal.py | 57 +++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/l10n_ar_account_reports/wizards/checks_to_date_view.xml b/l10n_ar_account_reports/wizards/checks_to_date_view.xml index 535d50f7..a8772604 100644 --- a/l10n_ar_account_reports/wizards/checks_to_date_view.xml +++ b/l10n_ar_account_reports/wizards/checks_to_date_view.xml @@ -1,5 +1,4 @@ - account.check.to_date.report.form @@ -22,6 +21,7 @@ Cheques a fecha account.check.to_date.report.wizard + new form @@ -33,5 +33,4 @@ action="action_account_check_to_date_report" /> - diff --git a/l10n_ar_account_tax_settlement/__manifest__.py b/l10n_ar_account_tax_settlement/__manifest__.py index bf4fa136..a5841950 100644 --- a/l10n_ar_account_tax_settlement/__manifest__.py +++ b/l10n_ar_account_tax_settlement/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { 'name': 'Tax Settlements For Argentina', - 'version': "15.0.1.4.0", + 'version': "15.0.1.5.0", 'category': 'Accounting', 'website': 'www.adhoc.com.ar', 'license': 'AGPL-3', diff --git a/l10n_ar_account_tax_settlement/models/account_journal.py b/l10n_ar_account_tax_settlement/models/account_journal.py index 8bde6841..843c81c3 100644 --- a/l10n_ar_account_tax_settlement/models/account_journal.py +++ b/l10n_ar_account_tax_settlement/models/account_journal.py @@ -61,6 +61,7 @@ class AccountJournal(models.Model): ('iibb_aplicado_api', 'TXT Perc/Ret IIBB aplicadas API'), ('iibb_aplicado_sircar', 'TXT Perc/Ret IIBB aplicadas SIRCAR'), ('iibb_aplicado_dgr_mendoza', 'TXT Perc/Ret IIBB aplicado DGR Mendonza'), + ('retenciones_iva', 'TXT Retenciones/Percepciones Sufridas IVA'), # ('other', 'Other') ]) @@ -1345,3 +1346,59 @@ def misiones_files_values(self, move_lines): 'txt_filename': ('Retenciones ' if payment else 'Percepciones ') + 'Misiones.txt', 'txt_content': content, }] + + def retenciones_iva_files_values(self, move_lines): + """ Implementado segun especificación indicada en ticket 54274.""" + self.ensure_one() + content = '' + for line in move_lines.sorted(key=lambda r: (r.date, r.id)): + payment = line.payment_id + if payment: + # regimen (long 3) + codigo_regimen = payment.tax_withholding_id.codigo_regimen + if not codigo_regimen: + raise ValidationError(_('No hay código de régimen en la configuración del impuesto "%s"') % ( + payment.tax_withholding_id.name)) + if len(codigo_regimen) < 3: + raise ValidationError(_('El código de régimen tiene que tener 3 dígitos en la configuración del impuesto "%s"') % (payment.tax_withholding_id.name)) + content += codigo_regimen[:3] + + # cuit agente (long 11) + content += payment.partner_id.ensure_vat() + + # fecha retención (long 10) + content += fields.Date.from_string(payment.date).strftime('%d/%m/%Y') + + # número comprobante (long 16) + content += re.sub('[^0-9\.-]', '', payment.name)[1:].ljust(16) + + # importe retención (long 16) + content += '%16.2f' % payment.amount + content += '\r\n' + elif line.move_id.is_invoice(): + # regimen (long 3) + codigo_regimen = line.tax_line_id.codigo_regimen + if not codigo_regimen: + raise ValidationError(_('No hay código de régimen en la configuración del impuesto "%s"') % ( + line.tax_withholding_id.name)) + if len(codigo_regimen) < 3: + raise ValidationError(_('El código de régimen tiene que tener 3 dígitos en la configuración del impuesto "%s"') % (line.tax_withholding_id.name)) + content += codigo_regimen[:3] + + # cuit agente (long 11) + content += line.move_id.partner_id.ensure_vat() + + # fecha retención (long 10) + content += fields.Date.from_string(line.move_id.invoice_date).strftime('%d/%m/%Y') + + # número comprobante (long 16) + content += line.move_id.l10n_latam_document_number.ljust(16) + + # importe retención (long 16) + content += '%16.2f' % line.balance + content += '\r\n' + + return [{ + 'txt_filename': ('Retenciones' if payment else 'Percepciones') + '_iva.txt', + 'txt_content': content, + }]