[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
This commit is contained in:
Denis Ledoux
2015-09-23 13:20:29 +02:00
parent 82caa363a5
commit a669433326
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 = [
+1 -1
View File
@@ -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})