Skip to content

Commit

Permalink
[MIG] crm_phone_call: Migrated to 10.0
Browse files Browse the repository at this point in the history
 - FIX: Correct some lint errors
  • Loading branch information
cubells committed Mar 31, 2017
1 parent f39e747 commit c25e699
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 126 deletions.
20 changes: 10 additions & 10 deletions crm_phonecall/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
===========
Expand Down Expand Up @@ -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.
29 changes: 0 additions & 29 deletions crm_phonecall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 <vicent.cubells@tecnativa.com>",
],
"depends": [
'crm',
'calendar',
Expand All @@ -27,5 +24,4 @@
'report/crm_phonecall_report_view.xml',
],
'installable': True,
"pre_init_hook": "rename_xmlids_hook",
}
2 changes: 1 addition & 1 deletion crm_phonecall/models/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 4 additions & 5 deletions crm_phonecall/models/crm_phonecall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions crm_phonecall/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(
Expand Down
17 changes: 9 additions & 8 deletions crm_phonecall/report/crm_phonecall_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 = """
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions crm_phonecall/report/crm_phonecall_report_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
help="Phone calls which are in pending state"/>
<separator/>
<filter string="My Sales Team(s)" context="{'invisible_section': False}" domain="[('team_id.user_id','=',uid)]"
help="Phone calls that are assigned to one of the sale teams I manage" groups="base.group_multi_salesteams"/>
help="Phone calls that are assigned to one of the sale teams I manage" groups="sales_team.group_sale_manager"/>
<separator/>
<filter string="My Phone Calls" help="Phone Calls that are assigned to me" domain="[('user_id','=',uid)]" />
<field name="team_id" string="Sales Team" context="{'invisible_section': False}"
groups="base.group_multi_salesteams"/>
groups="sales_team.group_sale_manager"/>
<field name="user_id" string="Salesperson"/>
<group expand="0" string="Extended Filters...">
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
Expand All @@ -75,7 +75,7 @@
</group>
<group expand="1" string="Group By">
<filter string="Salesperson" name="Salesperson" context="{'group_by':'user_id'}" />
<filter string="Sales Team" context="{'group_by':'team_id'}" groups="base.group_multi_salesteams"/>
<filter string="Sales Team" context="{'group_by':'team_id'}" groups="sales_team.group_sale_manager"/>
<filter string="Customer" context="{'group_by':'partner_id'}" />
<filter string="Status" context="{'group_by':'state'}" />
<separator/>
Expand All @@ -101,8 +101,8 @@
<field name="domain">[]</field>
</record>
<menuitem name="Phone Calls Analysis"
groups="base.group_sale_salesman"
groups="sales_team.group_sale_salesman"
action="crm_phonecall_report_action"
id="menu_report_crm_phonecalls_tree" parent="base.menu_sale_report" sequence="15"/>
id="menu_report_crm_phonecalls_tree" parent="sales_team.menu_sale_report" sequence="15"/>

</odoo>
8 changes: 4 additions & 4 deletions crm_phonecall/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion crm_phonecall/tests/test_crm_phonecall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading

0 comments on commit c25e699

Please sign in to comment.