diff --git a/crm_phonecall/README.rst b/crm_phonecall/README.rst index c9cc07adc5b..da5ba06f921 100644 --- a/crm_phonecall/README.rst +++ b/crm_phonecall/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -============== -Crm Phonecalls -============== +=============== +CRM phone calls +=============== * This module allows to manage phone calls in order to analyze them. @@ -13,18 +13,18 @@ Usage To use this module, you need to: -* Go to *Sales > Phone Calls > Logged Calls > Create*. -* If your user has *Show Scheduled Calls Menu* permission, you will see +#. Go to *Sales > Phone Calls > Logged Calls > Create*. +#. If your user has *Show Scheduled Calls Menu* permission, you will see scheduled calls menu too. -* In any moment you can schedule another call, schedule a meeting or convert +#. In any moment you can schedule another call, schedule a meeting or convert call contact to opportunity. -* Calls can be categorized and you can manage categories in *Sales > +#. Calls can be categorized and you can manage categories in *Sales > Configuration > Leads & Opportunities > Phone Calls > Categories*. -* Calls can be analyzed in *Sales > Reports > Phone Calls Analysis*. +#. Calls can be analyzed in *Sales > Reports > Phone Calls Analysis*. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/9.0 + :target: https://runbot.odoo-community.org/runbot/134/10.0 Bug Tracker =========== @@ -56,4 +56,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/crm_phonecall/__init__.py b/crm_phonecall/__init__.py index 2e2027612ea..f03a8710898 100644 --- a/crm_phonecall/__init__.py +++ b/crm_phonecall/__init__.py @@ -5,32 +5,3 @@ from . import models from . import wizard from . import report - - -xmlid_renames = [ - ('crm.group_scheduled_calls', 'crm_phonecall.group_scheduled_calls'), - ('crm.filter_crm_phonecall_phone_call_to_do', - 'crm_phonecall.filter_crm_phonecall_phone_call_to_do'), - ('crm.filter_crm_phonecall_delay_to_close', - 'crm_phonecall.filter_crm_phonecall_delay_to_close'), - ('crm.filter_crm_phonecall_sales_team', - 'crm_phonecall.filter_crm_phonecall_sales_team'), -] - - -def column_exists(cr, table, column): - cr.execute(""" - SELECT column_name - FROM information_schema.columns - WHERE table_name = %s AND column_name = %s""", (table, column)) - return bool(cr.fetchall()) - - -def rename_xmlids_hook(cr): - # Retrieve column phone_id saved on crm migration - if column_exists(cr, 'calendar_event', 'phone_id'): - cr.execute(""" - ALTER TABLE calendar_event - RENAME COLUMN openupgrade_legacy_90_phone_id TO phone_id""") - from openupgradelib import openupgrade - openupgrade.rename_xmlids(cr, xmlid_renames) diff --git a/crm_phonecall/__openerp__.py b/crm_phonecall/__manifest__.py similarity index 82% rename from crm_phonecall/__openerp__.py rename to crm_phonecall/__manifest__.py index 2a47d1f3a8c..ffdf6c70032 100644 --- a/crm_phonecall/__openerp__.py +++ b/crm_phonecall/__manifest__.py @@ -4,16 +4,13 @@ { "name": "CRM Phone Calls", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Customer Relationship Management", "author": "Odoo S.A., " "Tecnativa, " "Odoo Community Association (OCA)", "website": "http://www.tecnativa.com", "license": "AGPL-3", - "contributors": [ - "Vicent Cubells ", - ], "depends": [ 'crm', 'calendar', @@ -27,5 +24,4 @@ 'report/crm_phonecall_report_view.xml', ], 'installable': True, - "pre_init_hook": "rename_xmlids_hook", } diff --git a/crm_phonecall/models/calendar.py b/crm_phonecall/models/calendar.py index d3bdc59e7d2..8632916b4a8 100644 --- a/crm_phonecall/models/calendar.py +++ b/crm_phonecall/models/calendar.py @@ -3,7 +3,7 @@ # Copyright (C) 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import fields, models +from odoo import fields, models class CalendarEvent(models.Model): diff --git a/crm_phonecall/models/crm_phonecall.py b/crm_phonecall/models/crm_phonecall.py index 84e8402d3e4..f923a3d5be8 100644 --- a/crm_phonecall/models/crm_phonecall.py +++ b/crm_phonecall/models/crm_phonecall.py @@ -4,8 +4,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from datetime import datetime -from openerp import api, fields, models, _ -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT +from odoo import api, fields, models, _ +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT class CrmPhonecall(models.Model): @@ -30,7 +30,7 @@ class CrmPhonecall(models.Model): team_id = fields.Many2one( comodel_name='crm.team', string='Sales Team', - select=True, + index=True, help='Sales team to which Case belongs to.' ) user_id = fields.Many2one( @@ -270,6 +270,5 @@ def action_button_convert2opportunity(self): opportunity_dict = {} for call in self: opportunity_dict = call.convert_opportunity() - return self.env['crm.lead']\ - .redirect_opportunity_view(opportunity_dict[call.id]) + return opportunity_dict[call.id].redirect_opportunity_view() return opportunity_dict diff --git a/crm_phonecall/models/res_partner.py b/crm_phonecall/models/res_partner.py index 98b85361355..c91d90ec01e 100644 --- a/crm_phonecall/models/res_partner.py +++ b/crm_phonecall/models/res_partner.py @@ -3,7 +3,7 @@ # Copyright (C) 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, fields, models +from odoo import api, fields, models class ResPartner(models.Model): @@ -15,12 +15,12 @@ class ResPartner(models.Model): string='Phonecalls', ) phonecall_count = fields.Integer( - compute='_phonecall_count', + compute='_compute_phonecall_count', string="Phonecalls", ) @api.multi - def _phonecall_count(self): + def _compute_phonecall_count(self): for partner in self: partner.phonecall_count = self.env[ 'crm.phonecall'].search_count( diff --git a/crm_phonecall/report/crm_phonecall_report.py b/crm_phonecall/report/crm_phonecall_report.py index 97331a87a2e..c62b4c06aef 100644 --- a/crm_phonecall/report/crm_phonecall_report.py +++ b/crm_phonecall/report/crm_phonecall_report.py @@ -3,8 +3,8 @@ # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import tools -from openerp import fields, models +from odoo import tools +from odoo import api, fields, models AVAILABLE_STATES = [ ('draft', 'Draft'), @@ -50,7 +50,7 @@ class CrmPhonecallReport(models.Model): create_date = fields.Datetime( string='Create Date', readonly=True, - select=True, + index=True, ) delay_close = fields.Float( string='Delay to close', @@ -84,12 +84,12 @@ class CrmPhonecallReport(models.Model): ) opening_date = fields.Datetime( readonly=True, - select=True, + index=True, ) date_closed = fields.Datetime( string='Close Date', readonly=True, - select=True) + index=True) def _select(self): select_str = """ @@ -121,10 +121,11 @@ def _from(self): """ return from_str - def init(self, cr): + @api.model_cr + def init(self): - tools.drop_view_if_exists(cr, self._table) - cr.execute(""" + tools.drop_view_if_exists(self._cr, self._table) + self._cr.execute(""" create or replace view %s as ( %s %s diff --git a/crm_phonecall/report/crm_phonecall_report_view.xml b/crm_phonecall/report/crm_phonecall_report_view.xml index 95ed2a081e5..c5d907b03a3 100644 --- a/crm_phonecall/report/crm_phonecall_report_view.xml +++ b/crm_phonecall/report/crm_phonecall_report_view.xml @@ -61,11 +61,11 @@ help="Phone calls which are in pending state"/> + help="Phone calls that are assigned to one of the sale teams I manage" groups="sales_team.group_sale_manager"/> + groups="sales_team.group_sale_manager"/> @@ -75,7 +75,7 @@ - + @@ -101,8 +101,8 @@ [] + id="menu_report_crm_phonecalls_tree" parent="sales_team.menu_sale_report" sequence="15"/> diff --git a/crm_phonecall/security/ir.model.access.csv b/crm_phonecall/security/ir.model.access.csv index ed527c2c516..409d841f452 100644 --- a/crm_phonecall/security/ir.model.access.csv +++ b/crm_phonecall/security/ir.model.access.csv @@ -1,6 +1,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_crm_phonecall_manager,crm.phonecall.manager,model_crm_phonecall,base.group_sale_manager,1,1,1,1 -access_crm_phonecall,crm.phonecall,model_crm_phonecall,base.group_sale_salesman,1,1,1,0 -access_crm_phonecall_report_user,crm.phonecall.report.user,model_crm_phonecall_report,base.group_sale_salesman,1,0,0,0 -access_crm_phonecall_report_manager,crm.phonecall.report,model_crm_phonecall_report,base.group_sale_manager,1,1,1,1 +access_crm_phonecall_manager,crm.phonecall.manager,model_crm_phonecall,sales_team.group_sale_manager,1,1,1,1 +access_crm_phonecall,crm.phonecall,model_crm_phonecall,sales_team.group_sale_salesman,1,1,1,0 +access_crm_phonecall_report_user,crm.phonecall.report.user,model_crm_phonecall_report,sales_team.group_sale_salesman,1,0,0,0 +access_crm_phonecall_report_manager,crm.phonecall.report,model_crm_phonecall_report,sales_team.group_sale_manager,1,1,1,1 access_crm_phonecall_partner_manager,crm.phonecall.partner.manager,model_crm_phonecall,base.group_partner_manager,1,1,1,1 diff --git a/crm_phonecall/tests/test_crm_phonecall.py b/crm_phonecall/tests/test_crm_phonecall.py index d6c693e0efb..574e392a288 100644 --- a/crm_phonecall/tests/test_crm_phonecall.py +++ b/crm_phonecall/tests/test_crm_phonecall.py @@ -2,7 +2,7 @@ # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests import common +from odoo.tests import common class TestCrmPhoneCall(common.SavepointCase): diff --git a/crm_phonecall/views/crm_phonecall_view.xml b/crm_phonecall/views/crm_phonecall_view.xml index f99b08936a9..6ede2f1ad96 100644 --- a/crm_phonecall/views/crm_phonecall_view.xml +++ b/crm_phonecall/views/crm_phonecall_view.xml @@ -9,18 +9,18 @@ [] -

- Click to add a new category. -

+

+ Click to add a new category. +

Create specific phone call categories to better define the type of calls tracked in the system. -

+

+ parent="crm.menu_crm_config_lead" sequence="45"/> + id="menu_crm_case_phonecall-act" parent="menu_crm_config_phonecall"/> CRM - Phone Calls Tree @@ -31,16 +31,16 @@