diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index e118767b43b..b1d1804a389 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -287,7 +287,6 @@ class crm_case(object):
if part:
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
data = {'partner_address_id': addr['contact']}
- data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 1b0121cb278..7248c9f684c 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -279,7 +279,7 @@ class crm_lead(crm_case, osv.osv):
if 'stage_id' in vals and vals['stage_id']:
stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context)
- self.history(cr, uid, ids, _('Stage'), details=stage_obj.name)
+ self.history(cr, uid, ids, _("Changed Stage to: ") + stage_obj.name, details=_("Changed Stage to: ") + stage_obj.name)
message=''
for case in self.browse(cr, uid, ids, context=context):
if case.type == 'lead' or context.get('stage_type',False)=='lead':
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index f74bad42108..776cb970321 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -89,7 +89,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
-
+
+
-
-
+
+
+
-
-
-
+
diff --git a/addons/crm/wizard/crm_add_note.py b/addons/crm/wizard/crm_add_note.py
index 80e6fc6cad2..3419c89d33a 100644
--- a/addons/crm/wizard/crm_add_note.py
+++ b/addons/crm/wizard/crm_add_note.py
@@ -37,7 +37,7 @@ class crm_add_note(osv.osv_memory):
attach = [
(x.name, base64.decodestring(x.binary)) for x in obj.attachment_ids
]
- case_pool.history(cr, uid, [case], _("Note"), history=False,
+ case_pool.history(cr, uid, [case], self.pool.get('mailgate.message').truncate_data(cr, uid, obj.body, context=context), history=False,
details=obj.body, email_from=user_name, attach=attach)
if obj.state == 'unchanged':
diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py
index 280d2d3ea10..601b5fe4ff0 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity.py
+++ b/addons/crm/wizard/crm_lead_to_opportunity.py
@@ -37,34 +37,34 @@ class crm_lead2opportunity_partner(osv.osv_memory):
}
def default_get(self, cr, uid, fields, context=None):
- """
- Default get for name, opportunity_ids
- if there is an exisitng partner link to the lead, find all existing opportunity link with this partnet to merge
- all information together
- """
- lead_obj = self.pool.get('crm.lead')
- partner_id = False
+ """
+ Default get for name, opportunity_ids
+ if there is an exisitng partner link to the lead, find all existing opportunity link with this partnet to merge
+ all information together
+ """
+ lead_obj = self.pool.get('crm.lead')
+ partner_id = False
- res = super(crm_lead2opportunity_partner, self).default_get(cr, uid, fields, context=context)
- opportunities = res.get('opportunity_ids') or []
- name = 'convert'
- if res.get('partner_id'):
-
- partner_id = res.get('partner_id')
- ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', '=', 'opportunity')])
- if ids:
- name = 'merge'
- opportunities += ids
-
+ res = super(crm_lead2opportunity_partner, self).default_get(cr, uid, fields, context=context)
+ opportunities = res.get('opportunity_ids') or []
+ name = 'convert'
+ if res.get('partner_id'):
+
+ partner_id = res.get('partner_id')
+ ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', '=', 'opportunity')])
+ if ids:
+ name = 'merge'
+ opportunities += ids
+
- if 'name' in fields:
- res.update({'name' : name})
- if 'opportunity_ids' in fields:
- res.update({'opportunity_ids': opportunities})
-
+ if 'name' in fields:
+ res.update({'name' : name})
+ if 'opportunity_ids' in fields:
+ res.update({'opportunity_ids': opportunities})
+
- return res
+ return res
def view_init(self, cr, uid, fields, context=None):
"""
@@ -99,7 +99,7 @@ Leads Could not convert into Opportunity"))
'date_action': time.strftime('%Y-%m-%d %H:%M:%S')
}
lead.write(vals, context=context)
- leads.history(cr, uid, [lead], _('Opportunity'), details='Converted to Opportunity', context=context)
+ leads.history(cr, uid, [lead], _('Converted to opportunity'), details='Converted to Opportunity', context=context)
if lead.partner_id:
msg_ids = [ x.id for x in lead.message_ids]
self.pool.get('mailgate.message').write(cr, uid, msg_ids, {
diff --git a/addons/crm/wizard/crm_lead_to_opportunity_view.xml b/addons/crm/wizard/crm_lead_to_opportunity_view.xml
index e21278db32a..a5908c02562 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity_view.xml
+++ b/addons/crm/wizard/crm_lead_to_opportunity_view.xml
@@ -7,29 +7,28 @@
form
diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py
index 6be997eb93f..0d6280d9ea1 100644
--- a/addons/crm/wizard/crm_merge_opportunities.py
+++ b/addons/crm/wizard/crm_merge_opportunities.py
@@ -40,11 +40,7 @@ class crm_merge_opportunity(osv.osv_memory):
return False
def _concat_all(self, attr, ops):
- result = ''
- for op in ops:
- if hasattr(op, attr) and getattr(op, attr):
- result += ' # ' + getattr(op, attr)
- return result
+ return ', '.join([getattr(op, attr) for op in ops if hasattr(op, attr) and getattr(op, attr)])
def action_merge(self, cr, uid, ids, context=None):
"""
@@ -53,7 +49,7 @@ class crm_merge_opportunity(osv.osv_memory):
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of Phonecall to Opportunity IDs
- @param context: A standard dictionary for contextual values
+ @param context: A standard dictionary for contextual valuesn
@return : Dictionary value for created Opportunity form
"""
@@ -89,17 +85,17 @@ class crm_merge_opportunity(osv.osv_memory):
'state_id' : self._get_first_not_null_id('state_id', op_ids),
'description' : self._concat_all('description', op_ids), #not lost
'email' : self._get_first_not_null('email', op_ids), # !!
- 'fax' : self._get_first_not_null('fax', op_ids),
- 'mobile' : self._get_first_not_null('mobile', op_ids),
- 'partner_latitude' : hasattr(opp_obj,'partner_latitude') and self._get_first_not_null('partner_latitude', op_ids),
- 'partner_longitude' : hasattr(opp_obj,'partner_longitude') and self._get_first_not_null('partner_longitude', op_ids),
- 'partner_name' : self._get_first_not_null('partner_name', op_ids),
- 'phone' : self._get_first_not_null('phone', op_ids),
- 'probability' : self._get_first_not_null('probability', op_ids),
- 'planned_revenue' : self._get_first_not_null('planned_revenue', op_ids),
- 'street' : self._get_first_not_null('street', op_ids),
- 'street2' : self._get_first_not_null('street2', op_ids),
- 'zip' : self._get_first_not_null('zip', op_ids),
+ 'fax' : self._get_first_not_null('fax', op_ids),
+ 'mobile' : self._get_first_not_null('mobile', op_ids),
+ 'partner_latitude' : hasattr(opp_obj,'partner_latitude') and self._get_first_not_null('partner_latitude', op_ids),
+ 'partner_longitude' : hasattr(opp_obj,'partner_longitude') and self._get_first_not_null('partner_longitude', op_ids),
+ 'partner_name' : self._get_first_not_null('partner_name', op_ids),
+ 'phone' : self._get_first_not_null('phone', op_ids),
+ 'probability' : self._get_first_not_null('probability', op_ids),
+ 'planned_revenue' : self._get_first_not_null('planned_revenue', op_ids),
+ 'street' : self._get_first_not_null('street', op_ids),
+ 'street2' : self._get_first_not_null('street2', op_ids),
+ 'zip' : self._get_first_not_null('zip', op_ids),
}
@@ -110,9 +106,11 @@ class crm_merge_opportunity(osv.osv_memory):
for history in opp.message_ids:
new_history = message_obj.copy(cr, uid, history.id, default={'res_id': opp.id})
#Notification about loss of information
+ details = []
+ subject = ['Merged opportunities :']
for opp in op_ids:
- opp_obj._history(cr, uid, [first_opp], _('Merged from Opportunity: %s : Information lost : [Partner: %s, Stage: %s, Section: %s, Salesman: %s, Category: %s, Channel: %s, City: %s, Company: %s, Country: %s, Email: %s, Phone number: %s, Contact name: %s]')
- % ( opp.name, opp.partner_id.name or '',
+ subject.append(opp.name)
+ details.append(_('Merged Opportunity: %s\n Partner: %s\n Stage: %s\n Section: %s\n Salesman: %s\n Category: %s\n Channel: %s\n City: %s\n Company: %s\n Country: %s\n Email: %s\n Phone number: %s\n Contact name: %s') % ( opp.name, opp.partner_id.name or '',
opp.stage_id.name or '',
opp.section_id.name or '',
opp.user_id.name or '',
@@ -124,6 +122,10 @@ class crm_merge_opportunity(osv.osv_memory):
opp.email or '',
opp.phone or '',
opp.contact_name or ''))
+ subject = subject[0] + ", ".join(subject[1:])
+ details = "\n\n".join(details)
+
+ opp_obj._history(cr, uid, [first_opp], subject, details=details)
#data.update({'message_ids' : [(6, 0 ,self._concat_o2m('message_ids', op_ids))]})
opp_obj.write(cr, uid, [first_opp.id], data)
diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py
index 436bf47a873..37fca44b625 100644
--- a/addons/mail_gateway/mail_gateway.py
+++ b/addons/mail_gateway/mail_gateway.py
@@ -92,12 +92,13 @@ class mailgate_thread(osv.osv):
def history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \
email_from=False, message_id=False, references=None, attach=None, email_cc=None, \
email_bcc=None, email_date=None, context=None):
+ print "histpory",details
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param cases: a browse record list
- @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used
+ @param keyword: Subject of the history item
@param history: Value True/False, If True it makes entry in case History otherwise in Case Log
@param email: Email-To / Recipient address
@param email_from: Email From / Sender address if any
@@ -141,7 +142,7 @@ class mailgate_thread(osv.osv):
'res_id': case.id,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'message_id': message_id,
- 'description': details or (hasattr(case, 'description') and case.description or False),
+ 'description': details,
'attachment_ids': [(6, 0, attachments)]
}
@@ -169,6 +170,8 @@ class mailgate_thread(osv.osv):
'message_id': message_id,
'attachment_ids': [(6, 0, attachments)]
}
+
+ print data
obj.create(cr, uid, data, context=context)
return True
mailgate_thread()
@@ -251,15 +254,7 @@ class mailgate_message(osv.osv):
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
else:
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
- if message.name == _('Opportunity'):
- msg_txt += _("Converted to Opportunity")
- elif message.name == _('Note'):
- msg_txt = (message.user_id.name or '/') + _(' added note on ') + format_date_tz(message.date, tz) + ':\n\t'
- msg_txt += self.truncate_data(cr, uid, message.description, context=context)
- elif message.name == _('Stage'):
- msg_txt += _("Changed Stage to: ") + message.description
- else:
- msg_txt += _("Changed Status to: ") + message.name
+ msg_txt += message.name
result[message.id] = msg_txt
return result