From a669433326430caab705ede8d48eecda16d3ee10 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 23 Sep 2015 13:14:53 +0200 Subject: [PATCH] [FIX] sale, sale_crm: convert opp to quote, do not force note When converting an opportunity to a quotation, the note was forced to the `company_id.sale_note`, which could be `False`. This prevented the other possible defaults for note to be set, e.g. the note from the `website_quote` `template_id`. Besides, the note forced in this wizard: `sale_obj.get_salenote` was almost the same than the defaults of the sale.order: `company_id.sale_note` except the language, the note translation in partner lang. Therefore, the default value of `note` for sale.order has been changed to use this `get_salenote` method, which handle the language, so it's no longer required to pass it in the convertion wizard, the note will now be added as any default value, giving the possibility to add another note default value. opw-650050 --- addons/sale/sale.py | 2 +- addons/sale_crm/wizard/crm_make_sale.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 4661f77b6c0..82d86b70049 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -241,7 +241,7 @@ class sale_order(osv.osv): 'name': lambda obj, cr, uid, context: '/', 'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'], 'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'], - 'note': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.sale_note, + 'note': lambda self, cr, uid, context: self.get_salenote(cr, uid, [], context.get('partner_id'), context=context), 'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c), } _sql_constraints = [ diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index be7e0e56275..5535678e556 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -102,7 +102,6 @@ class crm_make_sale(osv.osv_memory): 'date_order': fields.datetime.now(), 'fiscal_position': fpos, 'payment_term':payment_term, - 'note': sale_obj.get_salenote(cr, uid, [case.id], partner.id, context=context), 'opportunity_id': case.id, 'campaign_id': case.campaign_id and case.campaign_id.id or False, 'medium_id': case.medium_id and case.medium_id.id or False, @@ -110,6 +109,7 @@ class crm_make_sale(osv.osv_memory): } if partner.id: vals['user_id'] = partner.user_id and partner.user_id.id or uid + context['partner_id'] = partner.id new_id = sale_obj.create(cr, uid, vals, context=context) sale_order = sale_obj.browse(cr, uid, new_id, context=context) case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})