[FIX] website_sale: fiscal_position must be passed to product_id_change in order to compute taxes correctly
bzr revid: dle@openerp.com-20140425145739-3s7wgsc6l0re3lhe
This commit is contained in:
parent
529bdd335b
commit
22edf72dc1
|
@ -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})
|
||||
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue