diff --git a/stockcli/stock.py b/stockcli/stock.py --- a/stockcli/stock.py +++ b/stockcli/stock.py @@ -124,7 +124,7 @@ def transfer_by_barcode(barcode: str) -> ) from_id = int_prompt.ask( - "From", + "From (Enter 0 to abort)", choices=choices, default=int(choices[0]), ) @@ -153,7 +153,7 @@ def transfer_by_barcode(barcode: str) -> ) to_id = int_prompt.ask( - "To", + "To (Enter 0 to abort)", choices=choices, default=int(choices[0]), ) @@ -161,7 +161,7 @@ def transfer_by_barcode(barcode: str) -> if not to_id: return - amount = int_prompt.ask("Amount") + amount = int_prompt.ask("Amount (Enter 0 to abort)") if not amount: return @@ -197,7 +197,11 @@ def add_by_barcode(barcode: str) -> None ) ) - amount = int_prompt.ask("Amount") + amount = int_prompt.ask("Amount (Enter 0 to abort)") + + if not amount: + return + data = {"amount": amount, "transaction_type": "purchase"} response = utils.post_request( @@ -231,7 +235,10 @@ def update_by_barcode(barcode: str) -> N subtitle="[blue]Update stock[/blue]", ) ) - amount = prompt.ask("Amount") + amount = int_prompt.ask("Amount (Enter 0 to abort)") + + if not amount: + return data = { "new_amount": amount,