diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index 42f4838f090..917ce1adfcd 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -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') diff --git a/addons/sale_stock/models/sale_order_line.py b/addons/sale_stock/models/sale_order_line.py index c9760b3c2fe..a81c3d7eff3 100644 --- a/addons/sale_stock/models/sale_order_line.py +++ b/addons/sale_stock/models/sale_order_line.py @@ -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":