Skip to content

error generacion archivo txt libro iva compras y ventas #60

@gbhadolfo

Description

@gbhadolfo

El error para version 15 y 16, no se en la 17, es cuando los comprobantes de ventas y compras estan en otra moneda que no es pesos.
Hay dos errores:

  1. informa en moneda origen y no en pesos en archivo txt de comprobantes y alicuotas

linea 625 del archivo l10n_ar_reports/models/account_vat_ledger.py
vat_taxes = inv._get_vat()

SOLUCION: Crear una nueva funcion, tomando como modelo la funcion _get_vat() del core addons/l10n_ar/models/account_move.py:

    def _get_vat_report(self, company_currency=False):
        """ Applies on wsfe web service and in the VAT digital books """
        amount_field = company_currency and 'balance' or 'price_subtotal'
        # if we use balance we need to correct sign (on price_subtotal is positive for refunds and invoices)
        sign = -1 if (company_currency and self.is_inbound()) else 1

        # if we are on a document that works invoice and refund and it's a refund, we need to export it as negative
        sign = -sign if self.move_type in ('out_refund', 'in_refund') and\
            self.l10n_latam_document_type_id.code in self._get_l10n_ar_codes_used_for_inv_and_ref() else sign

        res = []
        vat_taxable = self.env['account.move.line']
        # get all invoice lines that are vat taxable
        for line in self.line_ids:
            if any(tax.tax_group_id.l10n_ar_vat_afip_code and tax.tax_group_id.l10n_ar_vat_afip_code not in ['0', '1', '2'] for tax in line.tax_line_id) and line[amount_field]:
                vat_taxable |= line
        for tax_group in vat_taxable.mapped('tax_group_id'):
            base_imp = sum(self.invoice_line_ids.filtered(lambda x: x.tax_ids.filtered(lambda y: y.tax_group_id.l10n_ar_vat_afip_code == tax_group.l10n_ar_vat_afip_code)).mapped(amount_field))
            imp = sum(vat_taxable.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code == tax_group.l10n_ar_vat_afip_code).mapped(amount_field))
            res += [{'Id': tax_group.l10n_ar_vat_afip_code,
                     'BaseImp': sign * base_imp,
                     'Importe': sign * imp}]

        # Report vat 0%
        vat_base_0 = sign * sum(self.invoice_line_ids.filtered(lambda x: x.tax_ids.filtered(lambda y: y.tax_group_id.l10n_ar_vat_afip_code == '3')).mapped(amount_field))
        if vat_base_0:
            res += [{'Id': '3', 'BaseImp': vat_base_0, 'Importe': 0.0}]

        return res if res else [] 
  1. linea 446 del archivo l10n_ar_reports/models/account_vat_ledger.py informa en el txt el currency_rate, cuando no deberia
    self.format_amount(currency_rate, padding=10, decimals=6),

SOLUCION: reemplazar dicha linea por la siguiente self.format_amount(1, padding=10, decimals=6),#

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions