diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index 356ad59981b..0384918c35a 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -19,6 +19,7 @@ # ############################################################################## +from openerp import api from openerp.osv import osv, fields import uuid import time @@ -290,6 +291,8 @@ class sale_order_option(osv.osv): _defaults = { 'quantity': 1, } + + # TODO master: to remove, replaced by onchange of the new api def on_change_product_id(self, cr, uid, ids, product, context=None): vals = {} if not product: @@ -305,6 +308,17 @@ class sale_order_option(osv.osv): vals['name'] += '\n'+product_obj.description_sale return {'value': vals} + @api.onchange('product_id') + def _onchange_product_id(self): + product = self.product_id.with_context(lang=self.order_id.partner_id.lang) + self.price_unit = product.list_price + self.website_description = product.quote_description or product.website_description + self.name = product.name + if product.description_sale: + self.name += '\n' + product.description_sale + self.uom_id = product.product_tmpl_id.uom_id + + class product_template(osv.Model): _inherit = "product.template" diff --git a/addons/website_quote/views/website_quotation_backend.xml b/addons/website_quote/views/website_quotation_backend.xml index b831a4554e9..7f830319e43 100644 --- a/addons/website_quote/views/website_quotation_backend.xml +++ b/addons/website_quote/views/website_quotation_backend.xml @@ -15,7 +15,7 @@