From 568eedfc95ba22b3eea2a190f3c3a4ee28bce5a2 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Mon, 5 Apr 2010 15:20:29 +0530 Subject: [PATCH] [IMP]: crm project_issue: Apply some changes and function bzr revid: ksa@tinyerp.co.in-20100405095029-mc4vh0k66c8zfj6m --- addons/crm/crm.py | 1 - addons/crm/crm_lead.py | 20 ++++++++++++++++++++ addons/crm/crm_opportunity.py | 19 +++++++++++++++++++ addons/project_issue/project_issue.py | 19 +++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 8271ab025d2..3cebf30f3c3 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -747,7 +747,6 @@ class crm_case(osv.osv): data = {'state': 'open', 'active': True} if not case.user_id: data['user_id'] = uid - data.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) self.write(cr, uid, ids, data) self._action(cr, uid, cases, 'open') return True diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 73fd420aa63..8863791a28c 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -23,6 +23,7 @@ from osv import fields, osv, orm from datetime import datetime, timedelta import crm import math +import time from mx import DateTime from tools.translate import _ @@ -34,6 +35,25 @@ class crm_lead(osv.osv): _order = "priority desc, id desc" _inherit = ['res.partner.address', 'crm.case'] + def case_open(self, cr, uid, ids, *args): + """ + @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 ids: List of case's Ids + @param *args: Give Tuple Value + """ + + cases = self.browse(cr, uid, ids) + for case in cases: + data = {'state': 'open', 'active': True} + if not case.user_id: + data['user_id'] = uid + data.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) + self.write(cr, uid, ids, data) + self._action(cr, uid, cases, 'open') + return True + def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index e11aaedee09..0e635886e1c 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -40,6 +40,25 @@ class crm_opportunity(osv.osv): _order = "id desc" _inherit = 'crm.case' + def case_open(self, cr, uid, ids, *args): + """ + @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 ids: List of case's Ids + @param *args: Give Tuple Value + """ + + cases = self.browse(cr, uid, ids) + for case in cases: + data = {'state': 'open', 'active': True} + if not case.user_id: + data['user_id'] = uid + data.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) + self.write(cr, uid, ids, data) + self._action(cr, uid, cases, 'open') + return True + def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 248122ad854..f566e357dfd 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -37,6 +37,25 @@ class project_issue(osv.osv): _order = "priority, id desc" _inherit = 'crm.case' + def case_open(self, cr, uid, ids, *args): + """ + @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 ids: List of case's Ids + @param *args: Give Tuple Value + """ + + cases = self.browse(cr, uid, ids) + for case in cases: + data = {'state': 'open', 'active': True} + if not case.user_id: + data['user_id'] = uid + data.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) + self.write(cr, uid, ids, data) + self._action(cr, uid, cases, 'open') + return True + def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor,