P5-3248 - Fix package price calculations

This commit is contained in:
Anders Gustafsson
2018-12-05 14:21:53 +01:00
parent 5bbc519513
commit f680f0bcc3
2 changed files with 35 additions and 18 deletions
+20 -14
View File
@@ -80,11 +80,15 @@ def canvas_cm2_price(cm2):
return cm2_price
def package_price(width, height, market):
longest_side = max(width, height)
if longest_side > 119 and market.territory in ['US', 'EU']:
return 800
def package_price(product_group, width, height, market):
if market.territory in ['US', 'EU']:
if product_group == 'canvas' and max(width, height) > 119:
return 800
elif product_group == 'poster':
if width > 110:
return 1100
else:
return 400
return 0
@@ -103,7 +107,7 @@ def canvas_price(width, height, market, framed=True, designer=None, reseller=Non
price *= market.price_adjustments
# Package price should be added after market price adjustment but before other price adjustments.
price += package_price(width, height, market)
price += package_price('canvas', width, height, market)
if designer:
price *= (float(designer.pricepremium) / 100) + 1
@@ -133,11 +137,15 @@ def canvas_frame_price(width, height, market, reseller=None, rounded=True, inc_v
price = max(price, 317.44)
price *= 0.65
price *= market.price_adjustments
# Package price should be added after market price adjustment but before other price adjustments.
price += package_price('canvas', width, height, market)
if reseller:
price *= (float(reseller.pricepremium) / 100) + 1
price *= market.exchange_rate
price *= market.price_adjustments
if inc_vat:
price *= market.vat
@@ -185,12 +193,8 @@ def poster_price(width, height, market, hanger=True, designer=None, reseller=Non
price *= market.price_adjustments
# Price adjustment for high shipping costs to US and GLOBAL
if market.territory in ['US', 'EU']:
if width > 110:
price += 1100
else:
price += 400
# Package price should be added after market price adjustment but before other price adjustments.
price += package_price('poster', width, height, market)
if designer:
price *= (float(designer.pricepremium) / 100) + 1
@@ -218,7 +222,9 @@ def poster_hanger_price(width, market, reseller=None, rounded=True, inc_vat=True
price += 50 # add 50 SEK extra since they are buying only the hanger
price *= market.price_adjustments
price += package_price(width, 10, market) # we assume the poster hanger has a height of 10cm here
# Package price should be added after market price adjustment but before other price adjustments.
price += package_price('poster', width, 10, market) # we assume the poster hanger has a height of 10cm here
if reseller:
price *= (float(reseller.pricepremium) / 100) + 1