summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-06-27 17:34:48 +0000
committerThibault Delavallée <tde@odoo.com>2019-07-18 09:19:04 +0000
commited4c67adb2dc1eb821a72f5286452b8c5889f4fe (patch)
treeb9fed39b7b7f40de041105908921c8f06ded98c0
parentf18a089ca977bcc2c165e5fcebc440250cacb99f (diff)
[ADD] crm_sms: integrate SMS in CRM
PURPOSE We want to integrate SMS with crm.lead in the same way it is integrated with res.partner. SPECIFICATION Add phone/SMS widget on 'phone' and 'mobile' to call the same 'Send sms' modal than on partner. This modal can also be called from the action menu in list view. This modal should behave the same as for res.partner (same number selection and warnings). The SMS text message should also be logged in the chatter (similarly to res.partner) SMS sent in batch should be logged in the chatter of the corresponding record. Linked to task 1925950 Part of PR #34864
-rw-r--r--addons/crm/views/crm_lead_views.xml12
-rw-r--r--addons/crm_sms/__init__.py4
-rw-r--r--addons/crm_sms/__manifest__.py17
-rw-r--r--addons/crm_sms/models/__init__.py4
-rw-r--r--addons/crm_sms/models/crm_lead.py13
-rw-r--r--addons/crm_sms/views/crm_lead_views.xml27
6 files changed, 72 insertions, 5 deletions
diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml
index da376243cfb..db526541ae7 100644
--- a/addons/crm/views/crm_lead_views.xml
+++ b/addons/crm/views/crm_lead_views.xml
@@ -128,8 +128,8 @@
</div>
<field name="email_cc" groups="base.group_no_one"/>
<field name="function"/>
- <field name="phone" widget="phone"/>
- <field name="mobile"/>
+ <field name="phone" widget="phone" options="{'enable_sms': True}"/>
+ <field name="mobile" widget="phone" options="{'enable_sms': True}"/>
</group>
<group>
<field name="user_id" domain="[('share', '=', False)]"
@@ -603,10 +603,12 @@
attrs="{'invisible': [('partner_address_phone', '==', False)]}"
readonly="1"
widget="phone"
- string="Phone"/>
+ string="Phone"
+ options="{'enable_sms': True}"/>
<field name="phone"
attrs="{'invisible': [('partner_address_phone', '!=', False)]}"
- widget="phone"/>
+ widget="phone"
+ options="{'enable_sms': True}"/>
</group>
<group>
@@ -652,7 +654,7 @@
<field name="title" placeholder="Title" domain="[]" options='{"no_open": True}'/>
</div>
<field name="function"/>
- <field name="mobile"/>
+ <field name="mobile" widget="phone" options="{'enable_sms': True}"/>
</group>
<group string="Marketing">
<field name="campaign_id" />
diff --git a/addons/crm_sms/__init__.py b/addons/crm_sms/__init__.py
new file mode 100644
index 00000000000..dc5e6b693d1
--- /dev/null
+++ b/addons/crm_sms/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import models
diff --git a/addons/crm_sms/__manifest__.py b/addons/crm_sms/__manifest__.py
new file mode 100644
index 00000000000..cc3c7ab58b4
--- /dev/null
+++ b/addons/crm_sms/__manifest__.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+{
+ 'name': 'SMS in CRM',
+ 'version': '1.0',
+ 'category': 'Hidden',
+ 'summary': 'Add SMS capabilities to CRM',
+ 'description': "",
+ 'depends': ['crm', 'sms'],
+ 'data': [
+ 'views/crm_lead_views.xml',
+ ],
+ 'installable': True,
+ 'application': False,
+ 'auto_install': True,
+}
diff --git a/addons/crm_sms/models/__init__.py b/addons/crm_sms/models/__init__.py
new file mode 100644
index 00000000000..00140f99c9f
--- /dev/null
+++ b/addons/crm_sms/models/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import crm_lead
diff --git a/addons/crm_sms/models/crm_lead.py b/addons/crm_sms/models/crm_lead.py
new file mode 100644
index 00000000000..5f4fb88981c
--- /dev/null
+++ b/addons/crm_sms/models/crm_lead.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models
+
+
+class CrmLead(models.AbstractModel):
+ _inherit = 'crm.lead'
+
+ def _sms_get_number_fields(self):
+ """ This method returns the fields to use to find the number to use to
+ send an SMS on a record. """
+ return ['mobile', 'phone']
diff --git a/addons/crm_sms/views/crm_lead_views.xml b/addons/crm_sms/views/crm_lead_views.xml
new file mode 100644
index 00000000000..2b08fa5631f
--- /dev/null
+++ b/addons/crm_sms/views/crm_lead_views.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <!-- Add action entry in the Action Menu for Leads -->
+ <act_window id="crm_lead_act_window_sms_composer_single"
+ name="Send SMS Text Message"
+ binding_model="crm.lead"
+ res_model="sms.composer"
+ binding_views="list"
+ view_mode="form"
+ target="new"
+ context="{
+ 'default_composition_mode': 'mass',
+ 'default_mass_keep_log': True,
+ }"
+ />
+ <act_window id="crm_lead_act_window_sms_composer_multi"
+ name="Send SMS Text Message"
+ binding_model="crm.lead"
+ res_model="sms.composer"
+ binding_views="form"
+ view_mode="form"
+ target="new"
+ context="{
+ 'default_composition_mode': 'comment',
+ }"
+ />
+</odoo> \ No newline at end of file