From 86a376ceb25802828904092e4558fd3082c50cae Mon Sep 17 00:00:00 2001 From: aserbin Date: Mon, 15 Dec 2025 15:26:04 +0400 Subject: [PATCH] feat: sell_from_stock for marketplaces --- database/sipro/models/general.py | 3 ++- queries/general.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/database/sipro/models/general.py b/database/sipro/models/general.py index 839ea48..009028d 100644 --- a/database/sipro/models/general.py +++ b/database/sipro/models/general.py @@ -53,7 +53,8 @@ class Marketplace(BaseSiproModel): sell_mixes: Mapped[bool] = mapped_column() sell_blocks: Mapped[bool] = mapped_column() sell_warehouse_products: Mapped[bool] = mapped_column() - sell_from_price: Mapped[bool] = mapped_column() + sell_from_price: Mapped[int] = mapped_column() + sell_from_stock: Mapped[int] = mapped_column() is_deleted: Mapped[bool] = mapped_column() is_paused: Mapped[bool] = mapped_column() send_stocks: Mapped[bool] = mapped_column() diff --git a/queries/general.py b/queries/general.py index c801f36..b0d6600 100644 --- a/queries/general.py +++ b/queries/general.py @@ -357,7 +357,9 @@ async def get_stocks_data( full_stock = warehouse_stock if (not sell_mixes) and is_mix: full_stock = warehouse_stock - full_stock = max([0, full_stock]) + full_stock = max(0, full_stock) + if full_stock < marketplace.sell_from_stock: + full_stock = 0 base_dict['full_stock'] = full_stock response.append(base_dict) return response