summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorAnkit Sathvara <asa@odoo.com>2017-11-07 15:31:14 +0530
committerAaron Bohy <aab@odoo.com>2018-03-02 15:45:42 +0100
commit6be9fa39674786dd75bb74cdbc6c8c6b4d3eccbb (patch)
treecce8552c8f727a0bc8f23ef698527fc86d49614c /addons/web/static/src/js/fields
parent0ecfd7bf3e6f2751833ef7435f66dba0f564f5ad (diff)
[IMP] web,hr: Phone widget is always clickable
With this commit, when a phone number is clicked (in readonly), - if voip is not installed, it opens an app according to the user choice (e.g. skype), and on mobile, it opens the phone app to call the number - if voip is installed, in desktop, it opens voip, and on mobile, it still opens the phone app to call the number, because webRTC is not supported. This commit also makes the employee form view use the phone widget for the 'Work Phone' and 'Work Mobile' fields. Task #30369
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js53
1 files changed, 1 insertions, 52 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 061345683b6..67e5f9b559c 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -8,7 +8,6 @@ odoo.define('web.basic_fields', function (require) {
*/
var AbstractField = require('web.AbstractField');
-var config = require('web.config');
var core = require('web.core');
var crash_manager = require('web.crash_manager');
var datepicker = require('web.datepicker');
@@ -973,72 +972,22 @@ var FieldPhone = FieldEmail.extend({
className: 'o_field_phone',
prefix: 'tel',
- /**
- * The phone widget is an extension of email, with the distinction that, in
- * some cases, we do not want to show a clickable widget in readonly.
- * In particular, we only want to make it clickable if the device can call
- * this particular number. This is controlled by the _canCall function.
- *
- * @override
- */
- init: function () {
- this._super.apply(this, arguments);
- if (this.mode === 'readonly' && !this._canCall()) {
- this.tagName = 'span';
- }
- },
- /**
- * Returns the associated link only if there is one.
- *
- * @override
- */
- getFocusableElement: function () {
- if (this.mode !== 'readonly' || this._canCall()) {
- return this._super.apply(this, arguments);
- }
- return $();
- },
-
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
- * In readonly, we only make the widget clickable if the device can call it.
- * Additionally, we obfuscate the phone number to prevent Skype from seeing it.
- *
* @override
* @private
*/
_renderReadonly: function () {
this._super();
- if (this._canCall()) {
- // Split phone number into two to prevent Skype app from finding it
- var text = this.$el.text();
- var part1 = _.escape(text.substr(0, text.length/2));
- var part2 = _.escape(text.substr(text.length/2));
- this.$el.html(part1 + "&shy;" + part2);
- } else {
- this.$el.removeClass('o_form_uri');
- }
+
// This class should technically be there in case of a very very long
// phone number, but it breaks the o_row mechanism, which is more
// important right now.
this.$el.removeClass('o_text_overflow');
},
-
- /**
- * Phone fields are clickable in readonly on small screens ~= on phones.
- * This can be overriden by call-capable modules to display a clickable
- * link in different situations, like always regardless of screen size,
- * or only allow national calls for example.
- *
- * @override
- * @private
- */
- _canCall: function () {
- return config.device.isMobile;
- }
});
var UrlWidget = InputField.extend({