PW-865: Piterra bug fix

This commit is contained in:
Ruslan Getmansky
2017-12-06 16:24:47 +02:00
parent 8eb74f2a48
commit 8e33c1b102
4 changed files with 12 additions and 4 deletions
+3 -2
View File
@@ -139,13 +139,14 @@ def inquiry_price(inquiry, inc_price_retouch=True, rounded=True, inc_vat=True, *
height = kwargs.get('height', inquiry.height)
material = kwargs.get('material', inquiry.material)
framed = kwargs.get('framed', inquiry.framed)
reseller = kwargs.get('reseller', inquiry.dealer_store)
if inquiry.product_group == 'photo-wallpaper':
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':
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:
raise ValueError(
'Invalid product group: {}'.format(inquiry.product_group))
+4 -2
View File
@@ -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),
'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_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
return data
@@ -170,7 +171,8 @@ def inquiry_canvas(inquiry):
'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': 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
+2
View File
@@ -142,6 +142,7 @@ Sample response
"inquiry_price": 3595.50219975,
"inquiry_price_excl_retouch": 3595.50219975,
"inquiry_price_excl_vat": 2876.4017598,
"inquiry_price_excl_price_premium": 2876.4017598,
"m2_price": 268.72213750000003,
"m2_price_excl_vat": 214.97771,
"material": "standard-wallpaper",
@@ -151,6 +152,7 @@ Sample response
"inquiry_price": 3961.1464912499996,
"inquiry_price_excl_retouch": 3961.1464912499996,
"inquiry_price_excl_vat": 3168.9171929999998,
"inquiry_price_excl_price_premium": 3168.9171929999998,
"m2_price": 296.04981250000003,
"m2_price_excl_vat": 236.83985,
"material": "premium-wallpaper",
+3
View File
@@ -215,6 +215,9 @@ class TestPrice(unittest2.TestCase):
inquiry, inc_price_retouch=False))
self.assertEqual(152, inquiry_price(
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):
with mock.patch.object(Inquiry, 'market', sweden):