Add price from value for external product inquiries (#49)
This commit is contained in:
+14
-5
@@ -526,8 +526,7 @@ def inquiry_poster(inquiry):
|
||||
return data
|
||||
|
||||
|
||||
def inquiry_external_product(inquiry):
|
||||
external_id = request.args.get("external_product_id", type=str)
|
||||
def inquiry_external_product(inquiry, external_id):
|
||||
data = {
|
||||
"id": inquiry.id,
|
||||
"retouch_price": inquiry.local_price_retouch(rounded=False, inc_vat=True),
|
||||
@@ -591,10 +590,20 @@ def inquiry_framed_print(inquiry):
|
||||
@mod.route("/inquiry/<int:inquiry_id>", methods=["GET"])
|
||||
def inquiry(inquiry_id):
|
||||
inquiry = Inquiry.query.get_or_404(inquiry_id)
|
||||
external_id = request.args.get("external_product_id")
|
||||
external_product_id = request.args.get("external_product_id")
|
||||
sku = request.args.get("sku", type=str)
|
||||
if external_id:
|
||||
data = inquiry_external_product(inquiry)
|
||||
listprice = request.args.get("listprice")
|
||||
|
||||
if (listprice):
|
||||
if (listprice == 'canvas'):
|
||||
external_product_id = get_cheapest_canvas_product()
|
||||
elif (listprice == 'poster'):
|
||||
external_product_id = get_cheapest_poster_product()
|
||||
else:
|
||||
raise ValueError("Invalid listprice group {}".format(listprice))
|
||||
|
||||
if external_product_id:
|
||||
data = inquiry_external_product(inquiry, external_product_id)
|
||||
elif inquiry.product_group == "photo-wallpaper":
|
||||
data = inquiry_wallpaper(inquiry)
|
||||
elif inquiry.product_group == "canvas":
|
||||
|
||||
Reference in New Issue
Block a user