From 3df8ac359cae6c138b0b307cc46bb56d7828d239 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 18 Jan 2024 14:42:50 +0000 Subject: [PATCH] [FIX] account: Use context_today instead of today Before this commit, the date was being considered in UTC instead of the time zone of the current user. This is problematic in LATAM, where the time zone is negative. closes odoo/odoo#150956 X-original-commit: 95acd53827ed128b301800dbabd5a8d9d7cbd12c Signed-off-by: John Laterre (jol) --- addons/account/models/account_move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 7007ccca174..17572bb1093 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -671,7 +671,7 @@ class AccountMove(models.Model): def _compute_hide_post_button(self): for record in self: record.hide_post_button = record.state != 'draft' \ - or record.auto_post != 'no' and record.date > fields.Date.today() + or record.auto_post != 'no' and record.date > fields.Date.context_today(record) @api.depends('journal_id') def _compute_company_id(self): @@ -1068,7 +1068,7 @@ class AccountMove(models.Model): untaxed_amount_currency = invoice.amount_untaxed * sign untaxed_amount = invoice.amount_untaxed_signed invoice_payment_terms = invoice.invoice_payment_term_id._compute_terms( - date_ref=invoice.invoice_date or invoice.date or fields.Date.today(), + date_ref=invoice.invoice_date or invoice.date or fields.Date.context_today(invoice), currency=invoice.currency_id, tax_amount_currency=tax_amount_currency, tax_amount=tax_amount, @@ -4309,7 +4309,7 @@ class AccountMove(models.Model): :return (datetime.date): """ lock_dates = self._get_violated_lock_dates(invoice_date, has_tax) - today = fields.Date.today() + today = fields.Date.context_today(self) highest_name = self.highest_name or self._get_last_sequence(relaxed=True) number_reset = self._deduce_sequence_number_reset(highest_name) if lock_dates: