Skip to content
Permalink
Browse files

⬆️1️⃣1️⃣ res_partner_skype Port

  • Loading branch information...
Ommo73 committed Apr 11, 2019
1 parent e333ee3 commit fcbe360b0b50419acef3a56002fcdae20a54f54a
@@ -16,5 +16,5 @@
"qweb": [
'static/src/xml/base.xml',
],
'installable': False
'installable': True
}
@@ -1,25 +1,40 @@
odoo.define('res_partner_skype.widget', function (require) {
'use strict';

var core = require('web.core');
var FieldChar = core.form_widget_registry.get('char');
var fieldRegistry = require('web.field_registry');
var basicFields = require('web.basic_fields');
var InputField = basicFields.InputField;

var FieldSkype = FieldChar.extend({

var FieldSkype = InputField.extend({
className: 'o_field_skype',
template: 'FieldSkype',
prefix: 'skype',
init: function() {
events: _.extend({}, InputField.prototype.events, {
'click': '_onClick',
}),
supportedFieldTypes: ['char'],

init: function () {
this._super.apply(this, arguments);
this.clickable = true;
this.tagName = this.mode === 'readonly' ? 'a' : 'input';
},

getFocusableElement: function () {
return this.mode === 'readonly' ? this.$el : this._super.apply(this, arguments);
},

render_value: function() {
this._super();
if (this.get("effective_readonly") && this.clickable) {
this.$el.attr('href', this.prefix + ':' + this.get('value') + '?'+(this.options.type || 'call'));
}
}
_renderReadonly: function() {
this.$el.text(this.value)
.addClass('o_form_uri o_text_overflow')
.attr('href', this.prefix + ':' + this.value + '?'+ 'call');
},

_onClick: function (ev) {
ev.stopPropagation();
},
});

core.form_widget_registry.add('skype', FieldSkype);
fieldRegistry.add('skype', FieldSkype);

});
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="FieldSkype" t-extend="FieldEmail">
<t t-name="FieldSkype" t-extend="FieldReference">
<t t-jquery="span" t-operation="replace">
<t t-if="widget.get('effective_readonly')">
<a t-if="widget.clickable" class="o_form_uri o_text_overflow" href="#" target="_blank"/>

0 comments on commit fcbe360

Please sign in to comment.
You can’t perform that action at this time.