Skip to content

Commit

Permalink
[FIX] website_sale_stock: don't break product from non-website routes
Browse files Browse the repository at this point in the history
  • Loading branch information
xmo-odoo authored Dec 5, 2017
1 parent 03375da commit 96fcd4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/website_sale_stock/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class ProductProduct(models.Model):
cart_qty = fields.Integer(compute='_compute_cart_qty')

def _compute_cart_qty(self):
cart = request.website.sale_get_order()
website = getattr(request, 'website', None)
if not website:
return
cart = website.sale_get_order()
for product in self:
product.cart_qty = sum(cart.order_line.filtered(lambda p: p.product_id.id == product.id).mapped('product_uom_qty')) if cart else 0

0 comments on commit 96fcd4b

Please sign in to comment.