Skip to content

Commit

Permalink
[FIX] sale, sale_crm: convert opp to quote, do not force note
Browse files Browse the repository at this point in the history
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
  • Loading branch information
beledouxdenis committed Sep 23, 2015
1 parent 82caa36 commit a669433
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/sale/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def _get_default_company(self, cr, uid, context=None):
'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 = [
Expand Down
2 changes: 1 addition & 1 deletion addons/sale_crm/wizard/crm_make_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ def makeOrder(self, cr, uid, ids, context=None):
'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,
'source_id': case.source_id and case.source_id.id or False,
}
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})
Expand Down

0 comments on commit a669433

Please sign in to comment.