From 6df2aa1a41d2c287dac39af9ac13dda34152445f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Wed, 13 Jan 2021 08:33:15 +0000 Subject: [PATCH] [REF] stock: remove old `from_string` call in stock_quants.py Remove useless calls `fields.Datetime.from_string` from `_update_available_quantity`. task-2424248 closes odoo/odoo#64357 Related: odoo/upgrade#2074 Related: odoo/enterprise#15685 Signed-off-by: Arnold Moyaux --- addons/stock/models/stock_quant.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index ca365b9fc75..a6b1192f36f 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -389,13 +389,12 @@ class StockQuant(models.Model): quants = self._gather(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=True) incoming_dates = [d for d in quants.mapped('in_date') if d] - incoming_dates = [fields.Datetime.from_string(incoming_date) for incoming_date in incoming_dates] if in_date: incoming_dates += [in_date] # If multiple incoming dates are available for a given lot_id/package_id/owner_id, we # consider only the oldest one as being relevant. if incoming_dates: - in_date = fields.Datetime.to_string(min(incoming_dates)) + in_date = min(incoming_dates) else: in_date = fields.Datetime.now() @@ -426,7 +425,7 @@ class StockQuant(models.Model): 'owner_id': owner_id and owner_id.id, 'in_date': in_date, }) - return self._get_available_quantity(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=False, allow_negative=True), fields.Datetime.from_string(in_date) + return self._get_available_quantity(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=False, allow_negative=True), in_date @api.model def _update_reserved_quantity(self, product_id, location_id, quantity, lot_id=None, package_id=None, owner_id=None, strict=False):