Skip to content

Wrong Argentina withholding payment date behaviour #18903

Description

@pertile

In Argentina pay witholding documentation To date and From do not do what they say. In account_payment_register.py:132-144 it says that withholding will not be applied if date is after from_date (or from_date is empty) or if date is before to_date, which is exactly the opposite of what documentation says.

    @api.depends('partner_id', 'payment_date')
    def _compute_l10n_ar_withholding_ids(self):
        for wizard in self:
            date = wizard.payment_date or fields.Date.context_today(self)
            partner_taxes = self.env['l10n_ar.partner.tax'].search([
                *self.env['l10n_ar.partner.tax']._check_company_domain(wizard.company_id),
                '|', ('from_date', '>=', date), ('from_date', '=', False),
                '|', ('to_date', '<=', date), ('to_date', '=', False),
                ('partner_id', '=', wizard.partner_id.commercial_partner_id.id),
                ('tax_id.l10n_ar_withholding_payment_type', '=', wizard.partner_type),
                ('tax_id.active', '=', True)
            ])
            wizard.l10n_ar_withholding_ids = [Command.clear()] + [Command.create({'tax_id': x.tax_id.id}) for x in partner_taxes]

It could be a bug in code, but I think that from_date and to_date were intended to set an exemption for this withholding, that is when that withholding does not to apply to a specific range because tax Agency wanted to make an exemption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions