Fix: Recipe details shows the current sale price of product and also lets you edit the sale price.

This commit is contained in:
tanshu 2016-03-15 16:11:19 +05:30
parent 1b80c52763
commit 99439b63e8
2 changed files with 9 additions and 2 deletions

View File

@ -16,12 +16,18 @@
<md-input-container flex-gt-sm>
<input type="text" ng-model="recipe.Quantity" placeholder="Quantity"/>
</md-input-container>
<md-input-container flex-gt-sm ng-show="recipe.Product.IsSold">
<input type="text" ng-model="recipe.SalePrice" placeholder="Sale Price"/>
<md-tooltip md-direction="top">
Product's Sale Price {{recipe.Product.SalePrice}}, Recipe's Sale Price {{recipe.SalePrice}},
</md-tooltip>
</md-input-container>
<md-input-container class="md-block" flex-gt-sm>
<input type="text" readonly value="{{recipe.Product.Units}}"/>
</md-input-container>
<md-input-container class="md-block" flex-gt-sm>
<input type="text" readonly placeholder="Cost Price / Costing"
value="{{costPrice | currency}} / {{costPrice * 100 / recipe.Product.SalePrice | number:2}}%"/>
value="{{costPrice | currency}} / {{costPrice * 100 / recipe.SalePrice | number:2}}%"/>
</md-input-container>
<md-input-container ng-show="recipe.Product.IsSold">
<input type="text" readonly placeholder="Sale Price" value="{{recipe.Product.SalePrice}}"/>

View File

@ -246,7 +246,8 @@ def recipe_info(id, request):
else:
recipe = DBSession.query(Recipe).filter(Recipe.id == id).one()
info = {'RecipeID': recipe.id,
'Product': {'ProductID': recipe.product_id, 'Name': recipe.product.name, 'Units': recipe.product.units},
'Product': {'ProductID': recipe.product_id, 'Name': recipe.product.name, 'Units': recipe.product.units,
'SalePrice': recipe.product.sale_price},
'Quantity': recipe.quantity, 'SalePrice': recipe.sale_price, 'CostPrice': recipe.cost_price,
'ValidFrom': recipe.valid_from.strftime('%d-%b-%Y'), 'ValidTo': recipe.valid_to.strftime('%d-%b-%Y'),
'RecipeItems': []}