diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index b8673e73927..44ada2ffcc0 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -719,7 +719,6 @@ class crm_lead(base_stage, format_address, osv.osv): continue vals = self._convert_opportunity_data(cr, uid, lead, customer, section_id, context=context) self.write(cr, uid, [lead.id], vals, context=context) - self.message_post(cr, uid, ids, body=_("Lead converted into an Opportunity"), subtype="crm.mt_lead_convert_to_opportunity", context=context) if user_ids or section_id: self.allocate_salesman(cr, uid, ids, user_ids, section_id, context=context) diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index 0979a94eb3f..92914542d9d 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -163,12 +163,6 @@ Opportunity created - - Lead to Opportunity - crm.lead - - Lead converted into an opportunity - Stage Changed crm.lead @@ -195,13 +189,6 @@ section_id - - Lead to Opportunity - - crm.case.section - - section_id - Opportunity Stage Changed crm.case.section diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 6ddd06c1c90..df6a4a07a8e 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -601,7 +601,9 @@ 'default_email_to':'{$object.email or \'\'}', 'default_use_template': True, 'default_template_id': ref('crm.email_template_opportunity_mail'), - }"/> + }" + groups="base.group_sale_salesman" + /> @@ -617,6 +619,7 @@ if context.get('active_model') == 'crm.lead' and context.get('active_ids'): self.case_cancel(cr, uid, context['active_ids'], context=context) + diff --git a/addons/crm/wizard/crm_lead_to_opportunity_view.xml b/addons/crm/wizard/crm_lead_to_opportunity_view.xml index 4093df910d0..9ddd1fc701f 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity_view.xml +++ b/addons/crm/wizard/crm_lead_to_opportunity_view.xml @@ -102,7 +102,9 @@ res_model="crm.lead2opportunity.partner.mass" src_model="crm.lead" view_mode="form" target="new" view_type="form" context="{'mass_convert' : True}" - view_id="view_crm_lead2opportunity_partner_mass"/> + view_id="view_crm_lead2opportunity_partner_mass" + groups="base.group_sale_salesman" + /> diff --git a/addons/crm/wizard/crm_merge_opportunities_view.xml b/addons/crm/wizard/crm_merge_opportunities_view.xml index 919d83cb9a7..60693c13e19 100644 --- a/addons/crm/wizard/crm_merge_opportunities_view.xml +++ b/addons/crm/wizard/crm_merge_opportunities_view.xml @@ -45,7 +45,9 @@ multi="True" key2="client_action_multi" name="Merge leads/opportunities" res_model="crm.merge.opportunity" src_model="crm.lead" - view_mode="form" target="new" view_type="form"/> + view_mode="form" target="new" view_type="form" + groups="base.group_sale_salesman" + /> diff --git a/addons/crm_partner_assign/__init__.py b/addons/crm_partner_assign/__init__.py index bb4a3bb53be..6b1315cef07 100644 --- a/addons/crm_partner_assign/__init__.py +++ b/addons/crm_partner_assign/__init__.py @@ -20,6 +20,7 @@ ############################################################################## import crm_partner_assign +import crm_lead import wizard import report diff --git a/addons/crm_partner_assign/__openerp__.py b/addons/crm_partner_assign/__openerp__.py index b9b21ca7a6a..37a8c5a3d6b 100644 --- a/addons/crm_partner_assign/__openerp__.py +++ b/addons/crm_partner_assign/__openerp__.py @@ -37,17 +37,23 @@ The most appropriate partner can be assigned. You can also use the geolocalization without using the GPS coordinates. """, 'author': 'OpenERP SA', - 'depends': ['crm', 'account'], + 'depends': ['crm', 'account', 'portal'], 'demo': ['res_partner_demo.xml'], 'data': [ 'security/ir.model.access.csv', 'res_partner_view.xml', 'wizard/crm_forward_to_partner_view.xml', + 'wizard/crm_channel_interested_view.xml', 'crm_lead_view.xml', 'crm_partner_assign_data.xml', + 'crm_portal_view.xml', + 'portal_data.xml', 'report/crm_lead_report_view.xml', 'report/crm_partner_report_view.xml', ], + 'js': [ + 'static/src/js/next.js', + ], 'test': ['test/partner_assign.yml'], 'installable': True, 'auto_install': False, diff --git a/addons/crm_partner_assign/crm_lead.py b/addons/crm_partner_assign/crm_lead.py new file mode 100644 index 00000000000..37f4b9aedff --- /dev/null +++ b/addons/crm_partner_assign/crm_lead.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import osv +from openerp.tools.translate import _ + + +class crm_lead(osv.osv): + _inherit = 'crm.lead' + + def get_interested_action(self, cr, uid, interested, context=None): + try: + model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm_partner_assign', 'crm_lead_channel_interested_act') + except ValueError: + raise osv.except_osv(_('Error!'), _("The CRM Channel Interested Action is missing")) + action = self.pool[model].read(cr, uid, action_id, context=context) + action_context = eval(action['context']) + action_context['interested'] = interested + action['context'] = str(action_context) + return action + + def case_interested(self, cr, uid, ids, context=None): + return self.get_interested_action(cr, uid, True, context=context) + + def case_disinterested(self, cr, uid, ids, context=None): + return self.get_interested_action(cr, uid, False, context=context) diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml index 0d2837d6ca5..5c14680ee78 100644 --- a/addons/crm_partner_assign/crm_lead_view.xml +++ b/addons/crm_partner_assign/crm_lead_view.xml @@ -8,27 +8,33 @@ - + - - -