dont use deleted products

This commit is contained in:
2024-09-15 03:44:02 +03:00
parent 1aee085398
commit 4203cf722f

View File

@@ -63,7 +63,8 @@ async def get_stocks_data(
SupplierProduct
)
.where(
SupplierProduct.supplier_id.in_(supplier_ids)
SupplierProduct.supplier_id.in_(supplier_ids),
SupplierProduct.is_deleted == False
)
.group_by(
SupplierProduct.product_id
@@ -100,7 +101,8 @@ async def get_stocks_data(
SupplierProduct
)
.where(
SupplierProduct.supplier_id.in_(supplier_ids)
SupplierProduct.supplier_id.in_(supplier_ids),
SupplierProduct.is_deleted == False
)
.group_by(
SupplierProduct.product_id
@@ -173,7 +175,8 @@ async def get_stocks_data(
)
.where(
SupplierProduct.supplier_id.in_(supplier_ids),
(SupplierProduct.supplier_stock - SupplierProduct.sold_today) > 0
(SupplierProduct.supplier_stock - SupplierProduct.sold_today) > 0,
SupplierProduct.is_deleted == False
)
.group_by(
SupplierProduct.product_id
@@ -198,7 +201,8 @@ async def get_stocks_data(
.where(
SupplierProduct.supplier_id.in_(
supplier_ids
)
),
SupplierProduct.is_deleted == False
)
.group_by(
ProductRelation.master_product_id