Skip to content

Commit

Permalink
[FIX] website_sale: do not compute price of every pricelist
Browse files Browse the repository at this point in the history
This controller was very slow as not providing a pricelist computed the price of
all products of all pricelists.
Instead only fetch the prices for the useful products.
  • Loading branch information
mart-e committed Feb 3, 2016
1 parent d01ecb6 commit aca28c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/website_sale/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ def get_unit_price(self, product_ids, add_qty, use_order_pricelist=False, **kw):
pricelist_id = request.session.get('sale_order_code_pricelist_id') or partner.property_product_pricelist.id
else:
pricelist_id = partner.property_product_pricelist.id
prices = pool['product.pricelist'].price_rule_get_multi(cr, uid, [], [(product, add_qty, partner) for product in products], context=context)
prices = pool['product.pricelist'].price_rule_get_multi(cr, uid, [pricelist_id], [(product, add_qty, partner) for product in products], context=context)
return {product_id: prices[product_id][pricelist_id][0] for product_id in product_ids}

# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

0 comments on commit aca28c8

Please sign in to comment.