[FIX] website_sale: Coupon Code
The pricelist linked to the coupon code is just applied in the cart. In the shop, the pricelist of the user is applied. opw:634639
This commit is contained in:
parent
af86f029c9
commit
bff6dffbb4
|
@ -934,11 +934,14 @@ class website_sale(http.Controller):
|
|||
return ret
|
||||
|
||||
@http.route(['/shop/get_unit_price'], type='json', auth="public", methods=['POST'], website=True)
|
||||
def get_unit_price(self, product_ids, add_qty, **kw):
|
||||
def get_unit_price(self, product_ids, add_qty, use_order_pricelist=False, **kw):
|
||||
cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
|
||||
products = pool['product.product'].browse(cr, uid, product_ids, context=context)
|
||||
partner = pool['res.users'].browse(cr, uid, uid, context=context).partner_id
|
||||
pricelist_id = request.session.get('sale_order_code_pricelist_id') or partner.property_product_pricelist.id
|
||||
if use_order_pricelist:
|
||||
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)
|
||||
return {product_id: prices[product_id][pricelist_id][0] for product_id in product_ids}
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ $('.oe_website_sale').each(function () {
|
|||
if (isNaN(value)) value = 0;
|
||||
openerp.jsonRpc("/shop/get_unit_price", 'call', {
|
||||
'product_ids': product_ids,
|
||||
'add_qty': value})
|
||||
'add_qty': value,
|
||||
'use_order_pricelist': true})
|
||||
.then(function (res) {
|
||||
//basic case
|
||||
$dom.find('span.oe_currency_value').last().text(res[product_id].toFixed(2));
|
||||
|
|
Loading…
Reference in New Issue