[FIX] website_sale, website_sale_delivery, delivery: price computation on quantity...
[odoo/odoo.git] / addons / website_sale_delivery / models / website.py
1 # -*- coding: utf-8 -*-
2 from openerp.osv import orm
3 from openerp import SUPERUSER_ID
4
5
6 class Website(orm.Model):
7     _inherit = 'website'
8
9     def _ecommerce_create_quotation(self, cr, uid, context=None):
10         order_id = super(Website, self)._ecommerce_create_quotation(cr, uid, context=context)
11         order = self.pool['sale.order'].browse(cr, SUPERUSER_ID, order_id, context=context)
12         self.pool['sale.order']._check_carrier_quotation(cr, uid, order, force_carrier_id=None, context=context)
13         return order_id
14
15     def _ecommerce_add_product_to_cart(self, cr, uid, product_id=0, order_line_id=0, number=1, set_number=-1, context=None):
16         quantity = super(Website, self)._ecommerce_add_product_to_cart(cr, uid,
17             product_id=product_id, order_line_id=order_line_id, number=number, set_number=set_number,
18             context=context)
19         order = self.ecommerce_get_current_order(cr, uid, context=context)
20         self.pool['sale.order']._check_carrier_quotation(cr, uid, order, force_carrier_id=None, context=context) and quantity or None
21         return quantity