20 lines
556 B
Python
20 lines
556 B
Python
from grocy.models.schema import Schema
|
|
|
|
class RecipePos(Schema):
|
|
def __init__(self, **entries):
|
|
self.fields = [
|
|
'id', 'recipe_id',
|
|
'product_id', 'amount',
|
|
'note', 'qu_id',
|
|
'only_check_single_unit_in_stock',
|
|
'not_check_stock_fulfillment', 'ingredient_group'
|
|
]
|
|
self.__dict__.update(entries)
|
|
|
|
def toJSON(self):
|
|
obj = {}
|
|
for attr, value in self.__dict__.items():
|
|
if attr in self.fields:
|
|
obj[attr] = value
|
|
return obj
|