[IMP]:Improve Notification when merge opportunities
bzr revid: aja@tinyerp.com-20120921095547-xgxntbd3niwo0hak
This commit is contained in:
@@ -477,7 +477,7 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
def _merge_notification(self, cr, uid, opportunity_id, opportunities, context=None):
|
||||
#TOFIX: mail template should be used instead of fix body, subject text
|
||||
details = []
|
||||
merge_message = _('Merged opportunities')
|
||||
merge_message = _('Merged opportunities ')
|
||||
subject = [merge_message]
|
||||
fields = ['name', 'partner_id', 'stage_id', 'section_id', 'user_id', 'categ_ids', 'channel_id', 'company_id', 'contact_name',
|
||||
'email_from', 'phone', 'fax', 'mobile', 'state_id', 'description', 'probability', 'planned_revenue',
|
||||
@@ -556,8 +556,6 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
|
||||
data = self._merge_data(cr, uid, ids, oldest, fields, context=context)
|
||||
|
||||
# merge data into first opportunity
|
||||
self.write(cr, uid, [first_opportunity.id], data, context=context)
|
||||
|
||||
#copy message and attachements into the first opportunity
|
||||
self._merge_opportunity_history(cr, uid, first_opportunity.id, tail_opportunities, context=context)
|
||||
@@ -565,6 +563,8 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
|
||||
#Notification about loss of information
|
||||
self._merge_notification(cr, uid, first_opportunity, opportunities, context=context)
|
||||
# merge data into first opportunity
|
||||
self.write(cr, uid, [first_opportunity.id], data, context=context)
|
||||
#delete tail opportunities
|
||||
self.unlink(cr, uid, [x.id for x in tail_opportunities], context=context)
|
||||
|
||||
|
||||
@@ -143,8 +143,10 @@ class crm_lead2opportunity_partner(osv.osv_memory):
|
||||
lead = self.pool.get('crm.lead')
|
||||
lead_ids = context.get('active_ids', [])
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
self._convert_opportunity(cr, uid, ids, {'lead_ids': lead_ids}, context=context)
|
||||
self._merge_opportunity(cr, uid, ids, data.opportunity_ids, data.name, context=context)
|
||||
if data.name == "merge":
|
||||
self._merge_opportunity(cr, uid, ids, data.opportunity_ids, data.name, context=context)
|
||||
else:
|
||||
self._convert_opportunity(cr, uid, ids, {'lead_ids': lead_ids}, context=context)
|
||||
return lead.redirect_opportunity_view(cr, uid, lead_ids[0], context=context)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user