From 4c8a5b164a85bb3d4feeb89600c7dfbcdc33de10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 5 Aug 2016 14:24:21 +0200 Subject: [PATCH] [FIX][REF] website_quote: remove broken call to an old onchange website_quote still calls sale_order_line.product_id_change() in old API, giving arguments that are not supported anymore. It does not crash because 'reasons'. However the new onchange does not return values since v9. The call is therefore not necessary anymore and the computation has been adapted accordingly. --- addons/website_quote/models/order.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index 25f47f54d47..a40df82af92 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -205,25 +205,13 @@ class sale_order(osv.osv): lines = [(5,)] quote_template = self.pool.get('sale.quote.template').browse(cr, uid, template_id, context=context) for line in quote_template.quote_line: - res = self.pool.get('sale.order.line').product_id_change(cr, uid, False, - False, line.product_id.id, line.product_uom_qty, line.product_uom_id.id, line.product_uom_qty, - line.product_uom_id.id, line.name, partner, False, True, time.strftime('%Y-%m-%d'), - False, fiscal_position_id, True, context) - data = res.get('value', {}) if pricelist_id: - uom_context = context.copy() - uom_context['uom'] = line.product_uom_id.id + uom_context = dict(context, uom=line.product_uom_id.id) price = pricelist_obj.get_product_price(cr, uid, [pricelist_id], line.product_id, 1, False, context=uom_context) else: price = line.price_unit - if 'tax_id' in data: - data['tax_id'] = [(6, 0, data['tax_id'])] - else: - fpos = (fiscal_position_id and self.pool['account.fiscal.position'].browse(cr, uid, fiscal_position_id)) or False - taxes = fpos.map_tax(line.product_id.product_tmpl_id.taxes_id).ids if fpos else line.product_id.product_tmpl_id.taxes_id.ids - data['tax_id'] = [(6, 0, taxes)] - data.update({ + data = { 'name': line.name, 'price_unit': price, 'discount': line.discount, @@ -234,8 +222,17 @@ class sale_order(osv.osv): 'website_description': line.website_description, 'state': 'draft', 'customer_lead': self._get_customer_lead(cr, uid, line.product_id.product_tmpl_id), - }) + } + + if fiscal_position_id: + fpos = self.pool['account.fiscal.position'].browse(cr, uid, fiscal_position_id) + taxes = fpos.map_tax(line.product_id.product_tmpl_id.taxes_id).ids + else: + taxes = line.product_id.product_tmpl_id.taxes_id.ids + data['tax_id'] = [(6, 0, taxes)] + lines.append((0, 0, data)) + options = [] for option in quote_template.options: if pricelist_id: