Files
web/web_widget_url_translatable/static/src/js/fields.js
Thierry Ducrest 326ded3508 [12.0][ADD] web_widget_url_translatable
This module extends the URL widget, so it works the same than other
widget with translatable fields.
In edition mode the button that allows to open the tranlation view
is displayed.
2019-10-28 17:03:34 +01:00

25 lines
723 B
JavaScript

// Copyright 2019 Camptocamp SA
// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
//
odoo.define('web_widget_url_translatable', function (require) {
"use strict";
var basic_fields = require('web.basic_fields');
basic_fields.UrlWidget.include(basic_fields.TranslatableFieldMixin);
basic_fields.UrlWidget.include({
/* Add translation button */
_renderEdit: function () {
var def = this._super.apply(this, arguments);
if (this.field.size && this.field.size > 0) {
this.$el.attr('maxlength', this.field.size);
}
this.$el = this.$el.add(this._renderTranslateButton());
return def;
},
});
});