From 4b2556736ef09b14900b40168a66b1265037ea7a Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 12:06:56 +0100 Subject: [PATCH 1/8] [FIX]if convert lead to opp, if result merged data stage is not in sales team, then set the stage of the sales team with the lowest sequence bzr revid: dle@openerp.com-20130206110656-3tz2gccn8i3fu29w --- addons/crm/crm_lead.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index a8b7af300ad..6b839fa91df 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -37,6 +37,7 @@ CRM_LEAD_FIELDS_TO_MERGE = ['name', 'country_id', 'section_id', 'state_id', + 'stage_id', 'type_id', 'user_id', 'title', @@ -497,7 +498,7 @@ class crm_lead(base_stage, format_address, osv.osv): return res and res.id or False def _concat_all(attr): - return ', '.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) + return '\n\n'.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) # Process the fields' values data = {} @@ -645,6 +646,12 @@ class crm_lead(base_stage, format_address, osv.osv): opportunities = [highest] opportunities.extend(opportunities_rest) self._merge_notify(cr, uid, highest, opportunities, context=context) + # Check if the stage is in the stages of the sales team. If not, assign the stage with the lowest sequence + if merged_data.get('type') == 'opportunity' and merged_data.get('section_id'): + section_stages = self.pool.get('crm.case.section').read(cr, uid, merged_data['section_id'], ['stage_ids'], context=context) + if merged_data.get('stage_id') not in section_stages['stage_ids']: + stages_sequences = self.pool.get('crm.case.stage').search(cr, uid, [('id','in',section_stages['stage_ids'])], order='sequence', limit=1, context=context) + merged_data['stage_id'] = stages_sequences[0] # Write merged data into first opportunity self.write(cr, uid, [highest.id], merged_data, context=context) # Delete tail opportunities From fb58f9290b3fbc1a973507db6250c4fc42b1d8a4 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 12:15:36 +0100 Subject: [PATCH 2/8] [FIX]crm lead: When merge, logger message display now Merged lead or merged opportunity depending on the initial type bzr revid: dle@openerp.com-20130206111536-qbc70bqrweotwj1f --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 6b839fa91df..d5f90d8a653 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -566,7 +566,7 @@ class crm_lead(base_stage, format_address, osv.osv): subject = [merge_message] for opportunity in opportunities: subject.append(opportunity.name) - title = "%s : %s" % (merge_message, opportunity.name) + title = "%s : %s" % (opportunity.type == 'opportunity' and _('Merged opportunity') or _('Merged lead'), opportunity.name) details.append(self._mail_body(cr, uid, opportunity, CRM_LEAD_FIELDS_TO_MERGE, title=title, context=context)) # Chatter message's subject From 808fb96dede1c240772784869479ff473dccc3e8 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 14:12:34 +0100 Subject: [PATCH 3/8] [REVERT]lead merge text contact back to , instead of line return bzr revid: dle@openerp.com-20130206131234-9y73kgq6nqplt2lt --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index d5f90d8a653..5755174b7b7 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -498,7 +498,7 @@ class crm_lead(base_stage, format_address, osv.osv): return res and res.id or False def _concat_all(attr): - return '\n\n'.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) + return ','.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) # Process the fields' values data = {} From dc3af97631f3f5b13f829d9d924a7ca2c7f1c06a Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 14:18:48 +0100 Subject: [PATCH 4/8] [FIX]crm lead: merge lead/opps concatened description test bzr revid: dle@openerp.com-20130206131848-u1r7lc9r89a2zc3r --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 2f0b8e82956..d0aecb04db8 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -41,7 +41,7 @@ assert merge_id, 'Fail to create merge opportunity wizard' merge_result = self.browse(cr, uid, merge_id)[0] assert merge_result.partner_id.id == ref("base.res_partner_1"), 'Partner mismatch: when merging leads/opps with different m2o values, the first not null value prevails (the other are dropped)' - assert merge_result.description == 'This is the description of the test lead 1., This is the description of the test lead 2., This is the description of the test opp 1.', 'Description mismatch: when merging leads/opps with different text values, these values should get concatenated and separeted with ", "' + assert merge_result.description == 'This is the description of the test lead 1.\n\n This is the description of the test lead 2.\n\n This is the description of the test opp 1.', 'Description mismatch: when merging leads/opps with different text values, these values should get concatenated and separeted with ", "' assert merge_result.type == 'opportunity', 'Type mismatch: when at least one opp in involved in the merge, the result should be a new opp (instead of %s)' % merge_result.type - The other (tailing) leads/opps shouldn't exist anymore. From c84d60a74e5dad3ee6d11ec9622e71af23f230d6 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 14:22:19 +0100 Subject: [PATCH 5/8] [FIX]Forget to re-revert ,.join bzr revid: dle@openerp.com-20130206132219-o1y154vo40r0rsyx --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 5755174b7b7..d5f90d8a653 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -498,7 +498,7 @@ class crm_lead(base_stage, format_address, osv.osv): return res and res.id or False def _concat_all(attr): - return ','.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) + return '\n\n'.join(filter(lambda x: x, [getattr(opp, attr) or '' for opp in opportunities if hasattr(opp, attr)])) # Process the fields' values data = {} From beb4032c0dc16694f0bea86bdf3c1f1b82916433 Mon Sep 17 00:00:00 2001 From: "dle@openerp.com" <> Date: Wed, 6 Feb 2013 14:46:14 +0100 Subject: [PATCH 6/8] [FIX]Remove space in crm lead merge tests. bzr revid: dle@openerp.com-20130206134614-uzeb1vacqezh8n1a --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index d0aecb04db8..c50af5214e6 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -41,7 +41,7 @@ assert merge_id, 'Fail to create merge opportunity wizard' merge_result = self.browse(cr, uid, merge_id)[0] assert merge_result.partner_id.id == ref("base.res_partner_1"), 'Partner mismatch: when merging leads/opps with different m2o values, the first not null value prevails (the other are dropped)' - assert merge_result.description == 'This is the description of the test lead 1.\n\n This is the description of the test lead 2.\n\n This is the description of the test opp 1.', 'Description mismatch: when merging leads/opps with different text values, these values should get concatenated and separeted with ", "' + assert merge_result.description == 'This is the description of the test lead 1.\n\nThis is the description of the test lead 2.\n\nThis is the description of the test opp 1.', 'Description mismatch: when merging leads/opps with different text values, these values should get concatenated and separated with line returns' assert merge_result.type == 'opportunity', 'Type mismatch: when at least one opp in involved in the merge, the result should be a new opp (instead of %s)' % merge_result.type - The other (tailing) leads/opps shouldn't exist anymore. From 33ae77e803d804a7c2bcce867b647a625dec0895 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 6 Feb 2013 16:07:24 +0100 Subject: [PATCH 7/8] [IMP] web usermenu: add Help link bzr revid: chm@openerp.com-20130206150724-t4sul7d824z498v8 --- addons/web/static/src/js/chrome.js | 3 +++ addons/web/static/src/xml/base.xml | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 6dab0a4db14..b7b6c3df113 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1048,6 +1048,9 @@ instance.web.UserMenu = instance.web.Widget.extend({ }; this.update_promise = this.update_promise.then(fct, fct); }, + on_menu_help: function() { + window.open('http://help.openerp.com', '_blank'); + }, on_menu_logout: function() { this.trigger('user_logout'); }, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 7579eb9a55f..d56e0906270 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -40,7 +40,7 @@

- var message = d.message ? d.message : d.error.data.fault_code; + var message = d.message ? d.message : d.error.data.message; d.html_error = context.engine.tools.html_escape(message) .replace(/\n/g, '
');
@@ -403,8 +403,9 @@

From 222802f00192e73d0e665d61a9142b0b4683aa48 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 6 Feb 2013 16:11:05 +0100 Subject: [PATCH 8/8] [FIX] web_linkedin: possible problem with loading of images lp bug: https://launchpad.net/bugs/1116226 fixed bzr revid: nicolas.vanhoren@openerp.com-20130206151105-4xgxm350yje4vhtb --- addons/web_linkedin/web_linkedin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_linkedin/web_linkedin.py b/addons/web_linkedin/web_linkedin.py index dc429cd2f29..277b4497ffc 100644 --- a/addons/web_linkedin/web_linkedin.py +++ b/addons/web_linkedin/web_linkedin.py @@ -29,7 +29,12 @@ class Binary(openerp.addons.web.http.Controller): _cp_path = "/web_linkedin/binary" @openerp.addons.web.http.jsonrequest - def url2binary(self, req,url): + def url2binary(self, req, url): + if not url.startswith("http"): + raise Exception("Not allowed to load a file using this protocol") + if url.count("?") > 0 or url.count("&") > 0 or url.count("=") > 0: + raise Exception("Not allowed to use GET parameters") + req.session.assert_valid(force=True) bfile = urllib2.urlopen(url) return base64.b64encode(bfile.read())