From 7be461473149a680ddced5c030198da9054cbd11 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 20 Jun 2013 17:18:05 +0200 Subject: [PATCH] [ADD]crm_channel: portal, Im not interested button go to next lead or to list if none bzr revid: dle@openerp.com-20130620151805-pvjkozq41wwpfodo --- addons/crm_channel/__openerp__.py | 3 +++ addons/crm_channel/crm_lead.py | 10 ++++++++-- addons/crm_channel/static/src/js/next.js | 12 ++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 addons/crm_channel/static/src/js/next.js diff --git a/addons/crm_channel/__openerp__.py b/addons/crm_channel/__openerp__.py index d0aabe4f722..c0c1e6ef30f 100644 --- a/addons/crm_channel/__openerp__.py +++ b/addons/crm_channel/__openerp__.py @@ -52,6 +52,9 @@ You can also use the geolocalization without using the GPS coordinates. 'report/crm_partner_report_view.xml', 'data/lead_mail_template_data.xml', ], + 'js': [ + 'static/src/js/next.js', + ], 'test': ['test/partner_assign.yml'], 'installable': True, 'auto_install': False, diff --git a/addons/crm_channel/crm_lead.py b/addons/crm_channel/crm_lead.py index 5bdd3b6fd63..d08425729a1 100644 --- a/addons/crm_channel/crm_lead.py +++ b/addons/crm_channel/crm_lead.py @@ -44,8 +44,14 @@ class crm_lead(osv.osv): except ValueError: stage_id = False values = {} - # values = {'partner_assigned_id': False} + values = {'partner_assigned_id': False} if stage_id: values['stage_id'] = stage_id - self.write(cr, SUPERUSER_ID, ids, values, context=context) self.message_post(cr, uid, ids, body=_('I am not interested by this lead'), context=context) + self.write(cr, SUPERUSER_ID, ids, values, context=context) + return { + 'type': 'ir.actions.client', + 'tag': 'next_or_list', + 'params': { + }, + } diff --git a/addons/crm_channel/static/src/js/next.js b/addons/crm_channel/static/src/js/next.js new file mode 100644 index 00000000000..4f0c58c0e18 --- /dev/null +++ b/addons/crm_channel/static/src/js/next.js @@ -0,0 +1,12 @@ +openerp.crm_channel = function (instance) { + instance.crm_channel = instance.crm_channel || {}; + instance.crm_channel.next_or_list = function(parent) { + var form = parent.inner_widget.views.form.controller; + form.dataset.remove_ids([form.dataset.ids[form.dataset.index]]); + form.reload(); + if (!form.dataset.ids.length){ + parent.inner_widget.switch_mode('list'); + } + }; + instance.web.client_actions.add("next_or_list", "instance.crm_channel.next_or_list"); +} \ No newline at end of file