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

[IMP]l10n_ar_account_tax_settlement: retenciones y percepciones IVA txt #153

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion l10n_ar_account_tax_settlement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Tax Settlements For Argentina',
'version': '13.0.1.10.0',
'version': '13.0.1.11.0',
'category': 'Accounting',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
Expand Down
57 changes: 57 additions & 0 deletions l10n_ar_account_tax_settlement/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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')
])

Expand Down Expand Up @@ -1343,3 +1344,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)
pablohmontenegro marked this conversation as resolved.
Show resolved Hide resolved
content += payment.partner_id.ensure_vat()

# fecha retención (long 10)
content += fields.Date.from_string(payment.payment_date).strftime('%d/%m/%Y')

# número comprobante (long 16)
content += re.sub('[^0-9\.-]', '', payment.move_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)
pablohmontenegro marked this conversation as resolved.
Show resolved Hide resolved
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,
}]