Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Add subproduct substution to consume_product (#221)
Browse files Browse the repository at this point in the history
* Add subproduct substution to consume_product

* Formatting fix
  • Loading branch information
kingo55 committed Mar 7, 2022
1 parent 1c01627 commit e657b75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pygrocy/grocy.py
Expand Up @@ -148,9 +148,10 @@ def consume_product(
amount: float = 1,
spoiled: bool = False,
transaction_type: TransactionType = TransactionType.CONSUME,
allow_subproduct_substitution: bool = False,
):
return self._api_client.consume_product(
product_id, amount, spoiled, transaction_type
product_id, amount, spoiled, transaction_type, allow_subproduct_substitution
)

def inventory_product(
Expand Down
2 changes: 2 additions & 0 deletions pygrocy/grocy_api_client.py
Expand Up @@ -405,11 +405,13 @@ def consume_product(
amount: float = 1,
spoiled: bool = False,
transaction_type: TransactionType = TransactionType.CONSUME,
allow_subproduct_substitution: bool = False,
):
data = {
"amount": amount,
"spoiled": spoiled,
"transaction_type": transaction_type.value,
"allow_subproduct_substitution": allow_subproduct_substitution,
}

self._do_post_request(f"stock/products/{product_id}/consume", data)
Expand Down

0 comments on commit e657b75

Please sign in to comment.