Tax is added directly to product for sale

Auth guard and auth service simplified and fixed so that user is updated upon login
Home component changed to use square buttons
Fixed showing the totals in the bill

ng linted the project
This commit is contained in:
Amritanshu
2019-08-11 01:37:14 +05:30
parent d7fdf751b9
commit dcaf23b390
23 changed files with 334 additions and 266 deletions

View File

@ -1,6 +1,5 @@
import uuid
from decimal import Decimal, InvalidOperation
from functools import reduce
import transaction
from pyramid.response import Response
@ -193,15 +192,49 @@ def show_list_sale(request):
)
products = []
for item in list_:
products.append(
{
"id": item.id,
"name": item.name,
"units": item.units,
"saleCategory": {
"id": item.sale_category_id,
"name": item.sale_category.name,
},
"tax": {
"id": item.sale_category.tax_id,
"name": item.sale_category.tax.name,
"rate": item.sale_category.tax.rate,
},
"price": item.price,
"hasHappyHour": False,
"isNotAvailable": item.is_not_available,
"isActive": item.is_active,
"sortOrder": item.sort_order,
}
)
if item.has_happy_hour:
p = product_info(item, request.dbsession)
p["hasHappyHour"] = False
products.append(p)
i = product_info(item, request.dbsession)
i["name"] = "H + H " + i["name"]
products.append(i)
else:
products.append(product_info(item, request.dbsession))
products.append(
{
"id": item.id,
"name": "H H " + item.name,
"units": item.units,
"saleCategory": {
"id": item.sale_category_id,
"name": item.sale_category.name,
},
"tax": {
"id": item.sale_category.tax_id,
"name": item.sale_category.tax.name,
"rate": item.sale_category.tax.rate,
},
"price": item.price,
"hasHappyHour": True,
"isNotAvailable": item.is_not_available,
"isActive": item.is_active,
"sortOrder": item.sort_order,
}
)
return products
@ -251,7 +284,10 @@ def product_info(item, dbsession):
"saleCategory": {
"id": item.sale_category_id,
"name": item.sale_category.name,
"tax": {"id": item.sale_category.tax_id, "name": item.sale_category.name},
"tax": {
"id": item.sale_category.tax_id,
"name": item.sale_category.tax.name,
},
},
"price": item.price,
"hasHappyHour": item.has_happy_hour,