Skip to content

Commit cc566aa

Browse files
[FIX] l10n_ar_sale: Fix sale order line date.
The _l10n_ar_add_taxes method of account.fiscal.position of the l10n_ar_tax module ( https://github.com/ingadhoc/odoo-argentina/blob/18.0/l10n_ar_tax/models/account_fiscal_position.py#L10 ) gets the date of the sale.order as datetime.datetime (from l10n_ar_sale module https://github.com/ingadhoc/argentina-sale/blob/18.0/l10n_ar_sale/models/sale_order_line.py#L130 ) but compares it with the from_date and to_date fields of l10n_ar.partner.tax model which are of type datetime.date then we convert the date of the sale.order.line as datetime.date to make a homogeneous comparison between date fields of the same type (datetime.date). Also we ensure to use the timezone of Argentina to avoid issues with timezones when comparing dates. Ticket adhoc side: 97262
1 parent 6404ada commit cc566aa

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

l10n_ar_sale/models/sale_order_line.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ def _compute_tax_id(self):
126126
"""Agregado de taxes de modulo l10n_ar_tax segun fiscal position"""
127127
super()._compute_tax_id()
128128

129-
for rec in self.filtered("order_id.fiscal_position_id.l10n_ar_tax_ids"):
130-
date = rec.order_id.date_order
129+
for rec in self.with_context(tz="America/Argentina/Buenos_Aires").filtered(
130+
"order_id.fiscal_position_id.l10n_ar_tax_ids"
131+
):
132+
date = fields.Date.to_date(fields.Datetime.context_timestamp(rec, rec.order_id.date_order))
131133
rec.tax_id += rec.order_id.fiscal_position_id._l10n_ar_add_taxes(
132134
rec.order_partner_id, rec.company_id, date, "perception"
133135
)

0 commit comments

Comments
 (0)