Refactor Query.get() => Session.get() per SQLAlchemy 1.4

This commit is contained in:
Lance Edgar 2023-02-11 22:05:45 -06:00
parent 81aa0ae109
commit f611a5a521
38 changed files with 169 additions and 205 deletions

View file

@ -241,7 +241,7 @@ class OrderingBatchView(PurchasingBatchView):
assert not (batch.executed or batch.complete)
uuid = data.get('row_uuid')
row = self.Session.query(self.model_row_class).get(uuid) if uuid else None
row = self.Session.get(self.model_row_class, uuid) if uuid else None
if not row:
return {'error': "Row not found"}
if row.batch is not batch or row.removed:
@ -401,7 +401,7 @@ class OrderingBatchView(PurchasingBatchView):
return {'error': "Invalid value for units ordered: {}".format(units_ordered)}
uuid = data.get('product_uuid')
product = self.Session.query(model.Product).get(uuid) if uuid else None
product = self.Session.get(model.Product, uuid) if uuid else None
if not product:
return {'error': "Product not found"}