[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
Rémy Voet (ryv)
2021-01-21 11:09:58 +00:00
parent 71203e0aa2
commit 6df2aa1a41
+2 -3
View File
@@ -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):