PW-865: Piterra bug fix
This commit is contained in:
+3
-2
@@ -139,13 +139,14 @@ def inquiry_price(inquiry, inc_price_retouch=True, rounded=True, inc_vat=True, *
|
|||||||
height = kwargs.get('height', inquiry.height)
|
height = kwargs.get('height', inquiry.height)
|
||||||
material = kwargs.get('material', inquiry.material)
|
material = kwargs.get('material', inquiry.material)
|
||||||
framed = kwargs.get('framed', inquiry.framed)
|
framed = kwargs.get('framed', inquiry.framed)
|
||||||
|
reseller = kwargs.get('reseller', inquiry.dealer_store)
|
||||||
|
|
||||||
if inquiry.product_group == 'photo-wallpaper':
|
if inquiry.product_group == 'photo-wallpaper':
|
||||||
price = wallpaper_price(width, height, material, inquiry.market,
|
price = wallpaper_price(width, height, material, inquiry.market,
|
||||||
designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=False)
|
designer=inquiry.designer, reseller=reseller, inquiry=inquiry, rounded=False, inc_vat=False)
|
||||||
elif inquiry.product_group == 'canvas':
|
elif inquiry.product_group == 'canvas':
|
||||||
price = canvas_price(width, height, inquiry.market,
|
price = canvas_price(width, height, inquiry.market,
|
||||||
designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, framed=framed, rounded=False, inc_vat=False)
|
designer=inquiry.designer, reseller=reseller, inquiry=inquiry, framed=framed, rounded=False, inc_vat=False)
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Invalid product group: {}'.format(inquiry.product_group))
|
'Invalid product group: {}'.format(inquiry.product_group))
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ def inquiry_wallpaper(inquiry):
|
|||||||
'm2_price_excl_vat': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=False),
|
'm2_price_excl_vat': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=False),
|
||||||
'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_price_retouch=False, inc_vat=True),
|
'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_price_retouch=False, inc_vat=True),
|
||||||
'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=True),
|
'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=True),
|
||||||
'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=False)
|
'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=False),
|
||||||
|
'inquiry_price_excl_price_premium': inquiry_price(inquiry, material=material, width=width, height=height, reseller=None, inc_price_retouch=False, rounded=False, inc_vat=False)
|
||||||
})
|
})
|
||||||
data['prices'] = prices
|
data['prices'] = prices
|
||||||
return data
|
return data
|
||||||
@@ -170,7 +171,8 @@ def inquiry_canvas(inquiry):
|
|||||||
'height': height,
|
'height': height,
|
||||||
'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_price_retouch=False, inc_vat=True),
|
'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_price_retouch=False, inc_vat=True),
|
||||||
'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=True),
|
'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=True),
|
||||||
'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=False)
|
'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=False),
|
||||||
|
'inquiry_price_excl_price_premium': inquiry_price(inquiry, material=material, width=width, height=height, reseller=None, inc_price_retouch=False, framed=framed, rounded=False, inc_vat=False)
|
||||||
})
|
})
|
||||||
data['prices'] = prices
|
data['prices'] = prices
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ Sample response
|
|||||||
"inquiry_price": 3595.50219975,
|
"inquiry_price": 3595.50219975,
|
||||||
"inquiry_price_excl_retouch": 3595.50219975,
|
"inquiry_price_excl_retouch": 3595.50219975,
|
||||||
"inquiry_price_excl_vat": 2876.4017598,
|
"inquiry_price_excl_vat": 2876.4017598,
|
||||||
|
"inquiry_price_excl_price_premium": 2876.4017598,
|
||||||
"m2_price": 268.72213750000003,
|
"m2_price": 268.72213750000003,
|
||||||
"m2_price_excl_vat": 214.97771,
|
"m2_price_excl_vat": 214.97771,
|
||||||
"material": "standard-wallpaper",
|
"material": "standard-wallpaper",
|
||||||
@@ -151,6 +152,7 @@ Sample response
|
|||||||
"inquiry_price": 3961.1464912499996,
|
"inquiry_price": 3961.1464912499996,
|
||||||
"inquiry_price_excl_retouch": 3961.1464912499996,
|
"inquiry_price_excl_retouch": 3961.1464912499996,
|
||||||
"inquiry_price_excl_vat": 3168.9171929999998,
|
"inquiry_price_excl_vat": 3168.9171929999998,
|
||||||
|
"inquiry_price_excl_price_premium": 3168.9171929999998,
|
||||||
"m2_price": 296.04981250000003,
|
"m2_price": 296.04981250000003,
|
||||||
"m2_price_excl_vat": 236.83985,
|
"m2_price_excl_vat": 236.83985,
|
||||||
"material": "premium-wallpaper",
|
"material": "premium-wallpaper",
|
||||||
|
|||||||
@@ -215,6 +215,9 @@ class TestPrice(unittest2.TestCase):
|
|||||||
inquiry, inc_price_retouch=False))
|
inquiry, inc_price_retouch=False))
|
||||||
self.assertEqual(152, inquiry_price(
|
self.assertEqual(152, inquiry_price(
|
||||||
inquiry, inc_price_retouch=False, material=premium_wallpaper))
|
inquiry, inc_price_retouch=False, material=premium_wallpaper))
|
||||||
|
# test set reseller store to None to calculate inquiry price without reseller price premium
|
||||||
|
self.assertEqual(102, inquiry_price(
|
||||||
|
inquiry, inc_price_retouch=False, reseller=None))
|
||||||
|
|
||||||
def test_canvas_custom_inquiry_price(self):
|
def test_canvas_custom_inquiry_price(self):
|
||||||
with mock.patch.object(Inquiry, 'market', sweden):
|
with mock.patch.object(Inquiry, 'market', sweden):
|
||||||
|
|||||||
Reference in New Issue
Block a user