From 061122b7d98ceca2773adcb019b960474841974d Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Fri, 3 Dec 2010 18:13:01 +0530 Subject: [PATCH 1/5] [IMP] crm: Task1865: Probability is changed according to 'Mark won' and 'Mark lost' state. bzr revid: uco@tinyerp.com-20101203124301-03366utndcc3ndkg --- addons/crm/crm_opportunity.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 53f24dc69b0..9e1639fbea9 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -60,7 +60,11 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} + data_obj = self.pool.get('ir.model.data') + data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead5') + stage_id = data_obj.browse(cr, uid, data_id).res_id + stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability': stage_obj.probability, 'stage_id': stage_id} self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): @@ -79,9 +83,13 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} + data_obj = self.pool.get('ir.model.data') + data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead6') + stage_id = data_obj.browse(cr, uid, data_id).res_id + stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability': stage_obj.probability, 'stage_id': stage_id} - res = self.write(cr, uid, ids, value) + self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): opp = self.browse(cr, uid, id) if opp.type == 'opportunity': @@ -110,7 +118,7 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_reset(cr, uid, ids, *args) - self.write(cr, uid, ids, {'stage_id': False}) + self.write(cr, uid, ids, {'stage_id': False, 'probability': 0.0}) return res From 27360ddd7beb3a4fd7ec7cf2ffbc8c0f24a31dc1 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Fri, 3 Dec 2010 18:14:09 +0530 Subject: [PATCH 2/5] [FIX] fetchmail: Fixed user problem on email server. lp bug: https://launchpad.net/bugs/680884 fixed bzr revid: uco@tinyerp.com-20101203124409-qscsum988wvy9hxj --- addons/fetchmail/fetchmail.py | 5 +++-- addons/fetchmail/fetchmail_view.xml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 77748adf017..84490de2b53 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -150,6 +150,7 @@ class email_server(osv.osv): context.update({'get_server': True}) for server in self.browse(cr, uid, ids, context): count = 0 + user = server.user_id.id or uid try: if server.type == 'imap': imap_server = self.button_confirm_login(cr, uid, [server.id], context=context) @@ -157,7 +158,7 @@ class email_server(osv.osv): result, data = imap_server.search(None, '(UNSEEN)') for num in data[0].split(): result, data = imap_server.fetch(num, '(RFC822)') - res_id = email_tool.process_email(cr, uid, server.object_id.model, data[0][1], attach=server.attach, context=context) + res_id = email_tool.process_email(cr, user, server.object_id.model, data[0][1], attach=server.attach, context=context) if res_id and server.action_id: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]}) @@ -174,7 +175,7 @@ class email_server(osv.osv): for num in range(1, numMsgs + 1): (header, msges, octets) = pop_server.retr(num) msg = '\n'.join(msges) - res_id = email_tool.process_email(cr, uid, server.object_id.model, msg, attach=server.attach, context=context) + res_id = email_tool.process_email(cr, user, server.object_id.model, msg, attach=server.attach, context=context) if res_id and server.action_id: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]}) diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index ecdb4acfb3b..394761c09df 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -48,6 +48,7 @@ + From bd8bfab2da43249a860f09a9c44ea49b06006440 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Fri, 3 Dec 2010 18:16:39 +0530 Subject: [PATCH 3/5] [FIX] project: Fixed error occurring on planned hours. lp bug: https://launchpad.net/bugs/684472 fixed bzr revid: uco@tinyerp.com-20101203124639-62f62f7urjuj812y --- addons/project/project_view.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index d66a7529eee..339257af950 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -223,6 +223,9 @@ widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" on_change="onchange_planned(planned_hours, effective_hours)"/> + From 4387a4905d4182abe196d32b3aab9869376291f7 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Mon, 6 Dec 2010 16:53:23 +0530 Subject: [PATCH 4/5] [REF] crm: Change stage and probability only if 'Change Probability Automatically' is True. bzr revid: uco@tinyerp.com-20101206112323-6uve38soyw5q2x43 --- addons/crm/crm_opportunity.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 9e1639fbea9..1dc91261448 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -60,11 +60,13 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} data_obj = self.pool.get('ir.model.data') data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead5') stage_id = data_obj.browse(cr, uid, data_id).res_id stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability': stage_obj.probability, 'stage_id': stage_id} + if stage_obj.on_change: + value.update({'probability': stage_obj.probability, 'stage_id': stage_id}) self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): @@ -83,11 +85,13 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} data_obj = self.pool.get('ir.model.data') data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead6') stage_id = data_obj.browse(cr, uid, data_id).res_id stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability': stage_obj.probability, 'stage_id': stage_id} + if stage_obj.on_change: + value.update({'probability': stage_obj.probability, 'stage_id': stage_id}) self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): From f6377ddbff8cac838bf127d51c4fa76a2964180a Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Mon, 6 Dec 2010 17:46:30 +0530 Subject: [PATCH 5/5] [REF] crm: Change the stage according to state of opportunity. bzr revid: uco@tinyerp.com-20101206121630-uw1mpexll9pxfuk0 --- addons/crm/crm_opportunity.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 1dc91261448..b41621b6f00 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -60,13 +60,13 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} data_obj = self.pool.get('ir.model.data') data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead5') stage_id = data_obj.browse(cr, uid, data_id).res_id stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id} if stage_obj.on_change: - value.update({'probability': stage_obj.probability, 'stage_id': stage_id}) + value.update({'probability': stage_obj.probability}) self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): @@ -85,13 +85,13 @@ class crm_opportunity(osv.osv): @param *args: Tuple Value for additional Params """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) - value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} data_obj = self.pool.get('ir.model.data') data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead6') stage_id = data_obj.browse(cr, uid, data_id).res_id stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id) + value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id} if stage_obj.on_change: - value.update({'probability': stage_obj.probability, 'stage_id': stage_id}) + value.update({'probability': stage_obj.probability}) self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids):