-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make product unavailable if price is empty to avoid exception when adding product without price to basket #1913
Make product unavailable if price is empty to avoid exception when adding product without price to basket #1913
Conversation
Shouldn't we use the pricing policy to determine if a price is available? |
@mvantellingen right, I'll move check to pricing policy. But in general, what do you think about solution? |
src/oscar/apps/partner/strategy.py
Outdated
@@ -204,7 +204,7 @@ class StockRequired(object): | |||
def availability_policy(self, product, stockrecord): | |||
if not stockrecord: | |||
return availability.Unavailable() | |||
if not product.get_product_class().track_stock: | |||
if not product.get_product_class().track_stock and stockrecord.price_excl_tax: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to make products which are free (price is 0) unavailable. Not sure we want, perhaps:
if not stockrecord or stockrecord.price_excl_tax is None:
return availability.Unavailable()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Otherwise looks good?
581227b
to
7abc08a
Compare
@mvantellingen updated PR. Please check. |
…ding product without price to basket
7abc08a
to
82d9e7d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1913 +/- ##
==========================================
+ Coverage 82.77% 82.77% +<.01%
==========================================
Files 321 321
Lines 15348 15348
==========================================
+ Hits 12704 12705 +1
+ Misses 2644 2643 -1
Continue to review full report at Codecov.
|
…ce_excl_tax Make product unavailable if price is empty to avoid exception when adding product without price to basket
Revert changes in django-oscar#1913 and django-oscar#2294 that required a stock record to have price_excl_tax set in order to report the product as available. Add separate checks to the basket form/add logic that checks at the time of adding a product to the basket whether a price exists, and report an error if it doesn't. Fixes django-oscar#2664.
Fixes #1912