[FIX]URL widget is not easily accessible

This commit is contained in:
Fabien BOURGEOIS 2017-05-01 12:22:24 +02:00
parent 9997e55208
commit d2a07a151d

View File

@ -21,14 +21,14 @@ odoo.define('web.web_widget_url_check', function(require) {
'use strict';
var core = require('web.core');
var widget = require('web.form_widgets');
var FieldUrl = core.form_widget_registry.get('url');
var reUrl = /(?:https?:\/\/)?(?:[\w]+\.)([a-zA-Z\.]{2,6})([\/\w\.-]*)*\/?/;
widget.FieldUrl.include({
FieldUrl.include({
is_syntax_valid: function () {
var val = this.$('input').val() || '';
return ((val.length === 0) || reUrl.test(val));
}
});
};
});