grocy-cli/grocy/models/recipe_pos.py

20 lines
556 B
Python
Raw Normal View History

2019-04-28 16:12:05 -05:00
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