[FIX] website_sale: fiscal_position must be passed to product_id_change in order...
authorDenis Ledoux <dle@openerp.com>
Fri, 25 Apr 2014 14:57:39 +0000 (16:57 +0200)
committerDenis Ledoux <dle@openerp.com>
Fri, 25 Apr 2014 14:57:39 +0000 (16:57 +0200)
bzr revid: dle@openerp.com-20140425145739-3s7wgsc6l0re3lhe

addons/website_event_sale/models/sale_order.py
addons/website_sale/models/sale_order.py
addons/website_sale/models/website.py

index b94111a..26927a8 100644 (file)
@@ -7,15 +7,15 @@ from openerp.addons.web.http import request
 class sale_order_line(osv.osv):
     _inherit = "sale.order.line"
 
-    def _recalculate_product_values(self, cr, uid, ids, product_id=0, context=None):
+    def _recalculate_product_values(self, cr, uid, ids, product_id=0, fiscal_position=False, context=None):
         if not ids:
-            return super(sale_order_line, self)._recalculate_product_values(cr, uid, ids, product_id, context=context)
+            return super(sale_order_line, self)._recalculate_product_values(cr, uid, ids, product_id, fiscal_position=fiscal_position, context=context)
 
         order_line = self.browse(cr, SUPERUSER_ID, ids[0], context=context)
         assert order_line.order_id.website_session_id == request.httprequest.session['website_session_id']
 
         product = product_id and self.pool.get('product.product').browse(cr, uid, product_id, context=context) or order_line.product_id
-        res = super(sale_order_line, self)._recalculate_product_values(cr, uid, ids, product.id, context=context)
+        res = super(sale_order_line, self)._recalculate_product_values(cr, uid, ids, product.id, fiscal_position=fiscal_position, context=context)
         if product.event_type_id and order_line.event_ticket_id and order_line.event_ticket_id.price != product.lst_price:
             res.update({'price_unit': order_line.event_ticket_id.price})
 
index af5ff65..d9ff2e9 100644 (file)
@@ -33,7 +33,7 @@ class SaleOrder(osv.Model):
 class SaleOrderLine(osv.Model):
     _inherit = "sale.order.line"
 
-    def _recalculate_product_values(self, cr, uid, ids, product_id=0, context=None):
+    def _recalculate_product_values(self, cr, uid, ids, product_id=0, fiscal_position=False, context=None):
         # TDE FIXME: seems to be defined several times -> fix me ?
         if context is None:
             context = {}
@@ -49,5 +49,6 @@ class SaleOrderLine(osv.Model):
             pricelist=context.pop('pricelist'),
             product=product_id,
             partner_id=user_obj.browse(cr, SUPERUSER_ID, uid).partner_id.id,
+            fiscal_position=fiscal_position,
             context=context
         )['value']
index f5bdf60..6d07c59 100644 (file)
@@ -106,7 +106,7 @@ class Website(orm.Model):
 
         # change and record value
         if quantity:
-            vals = order_line_obj._recalculate_product_values(cr, uid, order_line_ids, product_id, context=context)
+            vals = order_line_obj._recalculate_product_values(cr, uid, order_line_ids, product_id, fiscal_position=order.fiscal_position.id, context=context)
             values.update(vals)
             values['product_uom_qty'] = quantity
             values['product_id'] = product_id