[FIX] purchase, stock : datetime is not correctly converted in date

With this commit datetime of stock move are correctly converted with the current timezone.

closes odoo/odoo#106886

X-original-commit: 242da76b2763d5add36da6e23d4b1f7e640c72aa
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Florent de Labarre
2022-11-30 19:05:53 +01:00
committed by Arnold Moyaux
parent c82e9d036c
commit ab1e076224
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -307,7 +307,7 @@ class PurchaseOrderLine(models.Model):
self.ensure_one()
moves = self.move_ids.filtered(lambda m: m.product_id == self.product_id)
if self._context.get('accrual_entry_date'):
moves = moves.filtered(lambda r: fields.Date.to_date(r.date) <= self._context['accrual_entry_date'])
moves = moves.filtered(lambda r: fields.Date.context_today(r, r.date) <= self._context['accrual_entry_date'])
return moves
@api.depends('move_ids.state', 'move_ids.product_uom_qty', 'move_ids.product_uom')
+1 -1
View File
@@ -266,7 +266,7 @@ class SaleOrderLine(models.Model):
moves = self.move_ids.filtered(lambda r: r.state != 'cancel' and not r.scrapped and self.product_id == r.product_id)
if self._context.get('accrual_entry_date'):
moves = moves.filtered(lambda r: fields.Date.to_date(r.date) <= self._context['accrual_entry_date'])
moves = moves.filtered(lambda r: fields.Date.context_today(r, r.date) <= self._context['accrual_entry_date'])
for move in moves:
if move.location_dest_id.usage == "customer":