diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 1b0cbed7937..9d276519b3f 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -72,20 +72,18 @@ Dashboard for CRM will include: 'wizard/crm_phonecall_to_phonecall_view.xml', - 'wizard/crm_opportunity_to_phonecall_view.xml', - 'wizard/crm_merge_opportunities_view.xml', 'crm_view.xml', + 'crm_phonecall_view.xml', + 'crm_phonecall_menu.xml', + 'crm_lead_view.xml', 'crm_lead_menu.xml', 'calendar_event_menu.xml', - 'crm_phonecall_view.xml', - 'crm_phonecall_menu.xml', - 'report/crm_lead_report_view.xml', 'report/crm_phonecall_report_view.xml', diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 6f522f0118f..5493d44ef21 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -317,6 +317,7 @@ class crm_lead(format_address, osv.osv): def on_change_partner_id(self, cr, uid, ids, partner_id, context=None): values = {} + phonecall_obj = self.pool.get('crm.phonecall') if partner_id: partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) values = { @@ -332,6 +333,8 @@ class crm_lead(format_address, osv.osv): 'fax': partner.fax, 'zip': partner.zip, } + call_ids = phonecall_obj.search(cr, uid, [('opportunity_id','in',ids)], context) + phonecall_obj.write(cr, uid, call_ids, {'partner_id': partner_id}, context) return {'value': values} def on_change_user(self, cr, uid, ids, user_id, context=None): diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index e76a7a9124d..09299337f32 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -104,9 +104,9 @@
-
diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml index dfc3a56858e..3b901184381 100644 --- a/addons/crm/security/crm_security.xml +++ b/addons/crm/security/crm_security.xml @@ -42,6 +42,11 @@ + + Show Scheduled Calls Menu + + + diff --git a/addons/crm/test/lead2opportunity2win.yml b/addons/crm/test/lead2opportunity2win.yml index a0952f4aa1f..8f8b855bb8e 100644 --- a/addons/crm/test/lead2opportunity2win.yml +++ b/addons/crm/test/lead2opportunity2win.yml @@ -31,18 +31,12 @@ - Now I begin communication and schedule a phone call with the customer. - - !python {model: crm.opportunity2phonecall}: | + !python {model: crm.phonecall2phonecall}: | import time - context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_3')]}) + context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_3')],'active_id': ref('crm_case_3')}) call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'), 'name': "Bonjour M. Jean, Comment allez-vous? J'ai bien reçu votre demande, pourrions-nous en parler quelques minutes?"}, context=context) self.action_schedule(cr, uid, [call_id], context=context) -- - I check that phonecall is scheduled for that opportunity. -- - !python {model: crm.phonecall}: | - ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_3'))]) - assert len(ids), 'Phonecall is not scheduled' - Now I schedule meeting with customer. - diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index 7bc2c97e5dd..c72e1f34fc8 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -21,7 +21,6 @@ import crm_partner_binding import crm_phonecall_to_phonecall -import crm_opportunity_to_phonecall import crm_lead_to_opportunity import crm_merge_opportunities diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py deleted file mode 100644 index 5183773b618..00000000000 --- a/addons/crm/wizard/crm_opportunity_to_phonecall.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- 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 fields, osv -from openerp.tools.translate import _ - -import time - -class crm_opportunity2phonecall(osv.osv_memory): - """Converts Opportunity to Phonecall""" - _inherit = 'crm.phonecall2phonecall' - _name = 'crm.opportunity2phonecall' - _description = 'Opportunity to Phonecall' - - def default_get(self, cr, uid, fields, context=None): - opp_obj = self.pool.get('crm.lead') - categ_id = False - data_obj = self.pool.get('ir.model.data') - try: - res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2') - categ_id = data_obj.browse(cr, uid, res_id, context=context).res_id - except ValueError: - pass - - record_ids = context and context.get('active_ids', []) or [] - res = {} - res.update({'action': 'log', 'date': time.strftime('%Y-%m-%d %H:%M:%S')}) - for opp in opp_obj.browse(cr, uid, record_ids, context=context): - if 'name' in fields: - res.update({'name': opp.name}) - if 'user_id' in fields: - res.update({'user_id': opp.user_id and opp.user_id.id or False}) - if 'section_id' in fields: - res.update({'section_id': opp.section_id and opp.section_id.id or False}) - if 'categ_id' in fields: - res.update({'categ_id': categ_id}) - if 'partner_id' in fields: - res.update({'partner_id': opp.partner_id and opp.partner_id.id or False}) - if 'contact_name' in fields: - res.update({'contact_name': opp.partner_id and opp.partner_id.name or False}) - if 'phone' in fields: - res.update({'phone': opp.phone or (opp.partner_id and opp.partner_id.phone or False)}) - return res - - def action_schedule(self, cr, uid, ids, context=None): - value = {} - if context is None: - context = {} - phonecall = self.pool.get('crm.phonecall') - opportunity_ids = context and context.get('active_ids') or [] - opportunity = self.pool.get('crm.lead') - data = self.browse(cr, uid, ids, context=context)[0] - call_ids = opportunity.schedule_phonecall(cr, uid, opportunity_ids, data.date, data.name, \ - data.note, data.phone, data.contact_name, data.user_id and data.user_id.id or False, \ - data.section_id and data.section_id.id or False, \ - data.categ_id and data.categ_id.id or False, \ - action=data.action, context=context) - return {'type': 'ir.actions.act_window_close'} - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml deleted file mode 100644 index d04d1bd9ccd..00000000000 --- a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - crm.opportunity2phonecall.form - crm.opportunity2phonecall - -
- - - - - - - - - - - - - - - -
-
- -
-
- - - - - Schedule/Log Call - crm.opportunity2phonecall - form - form - - new - - -
-
diff --git a/addons/crm/wizard/crm_phonecall_to_opportunity.py b/addons/crm/wizard/crm_phonecall_to_opportunity.py deleted file mode 100644 index e69de29bb2d..00000000000