[MERGE] base_setup, phone_validation: improve and fix SMS integration

PURPOSE

Allow auto install of all SMS-based feature. Move partner onchange formatting
directly inside phone validation.

SPECIFICATIONS

Phone validation: set as auto install. Phone validation module is a direct
dependency of SMS which is integrated in more and more business apps. As such
we want sms to be auto-installed, hence making phone_validation auto-install
as well.

Send SMS feature should not be an option anymore. Move SMS settings it to the
left of the Partner Autocomplete one and remove field. Since SMS is now
integrated with several business apps we do not want the user to uninstall that
module "by inadvertence".

Move the onchange on the phone field of contact model directly inside phone
validation to have it available in all SMS based applications.

LINKS

Task 2061765
FP/AJU request

closes odoo/odoo#36481

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Odoo's Mergebot
2019-09-09 16:27:50 +02:00
committed by GitHub
5 changed files with 29 additions and 25 deletions
@@ -29,7 +29,6 @@ class ResConfigSettings(models.TransientModel):
module_voip = fields.Boolean("Asterisk (VoIP)")
module_web_unsplash = fields.Boolean("Unsplash Image Library")
module_partner_autocomplete = fields.Boolean("Partner Autocomplete")
module_sms = fields.Boolean("Send SMS")
module_base_geolocalize = fields.Boolean("GeoLocalize")
report_footer = fields.Text(related="company_id.report_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.", readonly=False)
group_multi_currency = fields.Boolean(string='Multi-Currencies',
@@ -133,6 +133,14 @@
<div id="contacts_settings">
<h2>Contacts</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box" id="sms">
<div class="o_setting_right_pane" id="sms_settings">
<div class="o_form_label">Send SMS</div>
<div class="text-muted">
Send texts to your contacts
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box" title="When populating your address book, Odoo provides a list of matching companies. When selecting one item, the company data and logo are auto-filled." id="partner_autocomplete">
<div class="o_setting_left_pane">
<field name="module_partner_autocomplete"/>
@@ -144,17 +152,6 @@
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box" id="sms">
<div class="o_setting_left_pane">
<field name="module_sms"/>
</div>
<div class="o_setting_right_pane" id="sms_settings">
<label for="module_sms"/>
<div class="text-muted">
Send texts to your contacts
</div>
</div>
</div>
</div>
</div>
<div id="emails"/>
+1 -13
View File
@@ -6,7 +6,7 @@ from odoo import api, fields, models
class Partner(models.Model):
_name = 'res.partner'
_inherit = ['res.partner', 'phone.validation.mixin']
_inherit = 'res.partner'
team_id = fields.Many2one('crm.team', string='Sales Team')
opportunity_ids = fields.One2many('crm.lead', 'partner_id', string='Opportunities', domain=[('type', '=', 'opportunity')])
@@ -45,18 +45,6 @@ class Partner(models.Model):
for partner in self:
partner.meeting_count = len(partner.meeting_ids)
# Phone Validation
# ----------------
@api.onchange('phone', 'country_id', 'company_id')
def _onchange_phone_validation(self):
if self.phone:
self.phone = self.phone_format(self.phone)
@api.onchange('mobile', 'country_id', 'company_id')
def _onchange_mobile_validation(self):
if self.mobile:
self.mobile = self.phone_format(self.mobile)
def schedule_meeting(self):
partner_ids = self.ids
partner_ids.append(self.env.user.partner_id.id)
+1
View File
@@ -31,4 +31,5 @@ It adds two mixins :
'base',
'mail',
],
'auto_install': True,
}
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class Partner(models.Model):
_name = 'res.partner'
_inherit = ['res.partner', 'phone.validation.mixin']
@api.onchange('phone', 'country_id', 'company_id')
def _onchange_phone_validation(self):
if self.phone:
self.phone = self.phone_format(self.phone)
@api.onchange('mobile', 'country_id', 'company_id')
def _onchange_mobile_validation(self):
if self.mobile:
self.mobile = self.phone_format(self.mobile)