кнопки пополнения и изменения положения в карточках и на складе

This commit is contained in:
2025-12-14 23:09:43 +03:00
parent a99d82c8e3
commit 1a677f9ef2
8 changed files with 219 additions and 6 deletions
Binary file not shown.
Binary file not shown.
+8 -4
View File
@@ -17,7 +17,7 @@ class StocksActions:
toolbox_id: int,
user_id: int,
quantity: int,
price: int,
price: float,
placement: str,
reason: str,
) -> bool:
@@ -33,7 +33,7 @@ class StocksActions:
logger.error(
f"Приход инструмента {toolkit_id} на складе {toolbox_id} не удалось"
)
return False
return {"errorMessage": "Приход инструмента не удалось"}
recorded = await StocksRecordsHandler.add(
action="Приход",
@@ -64,8 +64,12 @@ class StocksActions:
logger.error(
f"Обновление даты последнего заполнения инструмента {toolkit_id} не удалось"
)
return accepted
return False
return (
{"errorMessage": "Приход инструмента не удалось"}
if not accepted
else {}
)
return {"errorMessage": "Приход инструмента не удалось"}
async def moving(
action: str,
+2 -1
View File
@@ -103,7 +103,8 @@ class StockHandler:
async def add(**kwargs) -> dict:
newStock = await Stock(**kwargs).save()
if "placement" in kwargs and kwargs["placement"]:
await PlacementHandler.add(**kwargs)
if kwargs["placement"] != "":
await PlacementHandler.add(**kwargs)
logger.info(
f"Новая запись об инструменте {newStock.toolkit_data.title} на складе {newStock.toolbox_data.title} успешно создана"
)