Fix: Units not showing in recipe list
Fix: Recipe update gave error
This commit is contained in:
parent
1448120941
commit
35413166d4
@ -132,6 +132,9 @@ def update(request):
|
||||
recipe_cost += rate * quantity
|
||||
recipe_items.append(RecipeItem(None, product.id, quantity, ingredient_price))
|
||||
recipe.product.price = recipe_cost
|
||||
for i in range(len(recipe.recipe_items), 0, -1):
|
||||
recipe_item = recipe.recipe_items.pop()
|
||||
DBSession.delete(recipe_item)
|
||||
recipe.recipe_items = []
|
||||
for recipe_item in recipe_items:
|
||||
recipe_item.recipe_id = recipe.id
|
||||
@ -209,10 +212,11 @@ def show_list(request):
|
||||
'Price': cost_rate, 'Quantity': recipe_item.quantity})
|
||||
costing = 0 if item.sale_price == 0 else cost_price / item.sale_price
|
||||
current_costing = 0 if item.sale_price == 0 else current_cost_price / item.sale_price
|
||||
recipe = {'Name': item.product.name, 'Date': item.date.strftime('%d-%b-%Y'), 'SalePrice': item.sale_price,
|
||||
'CostPrice': cost_price, 'CurrentCostPrice': current_cost_price, 'Costing': costing,
|
||||
'CurrentCosting': current_costing, 'IsSemi': item.product.is_semi, 'RecipeItems': recipe_items,
|
||||
'IsLatest': previous_product_id != item.product.id, 'Url': request.route_url('recipe_id', id=item.id)}
|
||||
recipe = {'Name': item.product.name, 'Units': item.product.units, 'Date': item.date.strftime('%d-%b-%Y'),
|
||||
'SalePrice': item.sale_price, 'CostPrice': cost_price, 'CurrentCostPrice': current_cost_price,
|
||||
'Costing': costing, 'CurrentCosting': current_costing, 'IsSemi': item.product.is_semi,
|
||||
'RecipeItems': recipe_items, 'IsLatest': previous_product_id != item.product.id,
|
||||
'Url': request.route_url('recipe_id', id=item.id)}
|
||||
recipes.append(recipe)
|
||||
previous_product_id = item.product.id
|
||||
return recipes
|
||||
|
Loading…
Reference in New Issue
Block a user