From 77e42e1a98eba4b27c80b9ac124030c57a03b54c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 25 Jan 2012 17:04:17 +0100 Subject: [PATCH] [IMP] crm.lead: set case opening date when opening automatically bzr revid: odo@openerp.com-20120125160417-r2q4c1k63v6jrh75 --- addons/crm/crm_lead.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 100227e3397..566885e3c46 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -545,8 +545,10 @@ class crm_lead(crm_case, osv.osv): 'type': 'opportunity', 'stage_id': stage_id or False, 'date_action': time.strftime('%Y-%m-%d %H:%M:%S'), - 'partner_address_id': contact_id + 'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), + 'partner_address_id': contact_id, } + def _convert_opportunity_notification(self, cr, uid, lead, context=None): success_message = _("Lead '%s' has been converted to an opportunity.") % lead.name self.message_append(cr, uid, [lead.id], success_message, body_text=success_message, context=context) @@ -777,7 +779,10 @@ class crm_lead(crm_case, osv.osv): for case in self.browse(cr, uid, ids, context=context): values = dict(vals) if case.state in CRM_LEAD_PENDING_STATES: - values.update(state=crm.AVAILABLE_STATES[1][0]) #re-open + #re-open + values.update(state=crm.AVAILABLE_STATES[1][0]) + if not case.date_open: + values['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) res = self.write(cr, uid, [case.id], values, context=context) return res