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

error generacion archivo txt libro iva compras y ventas #60

Open
gbhadolfo opened this issue Mar 22, 2024 · 0 comments
Open

error generacion archivo txt libro iva compras y ventas #60

gbhadolfo opened this issue Mar 22, 2024 · 0 comments

Comments

@gbhadolfo
Copy link

gbhadolfo commented Mar 22, 2024

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),#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant