[MIG] web_widget_char_size: Migration to 16.0

This commit is contained in:
anusrinps96
2024-12-02 10:24:50 +01:00
parent e9d4a4a1d0
commit f48ad0b65b
6 changed files with 30 additions and 39 deletions

View File

@@ -0,0 +1,10 @@
/** @odoo-module **/
import {CharField} from "@web/views/fields/char/char_field";
const _extractProps = CharField.extractProps;
CharField.extractProps = ({attrs, field}) => {
return Object.assign(_extractProps({attrs, field}), {
maxLength: field.size || attrs.options.size,
});
};

View File

@@ -1,16 +0,0 @@
odoo.define("web_widget_char_size.char_widget", function (require) {
"use strict";
var BasicFields = require("web.basic_fields");
BasicFields.FieldChar.include({
_renderEdit: function () {
var def = this._super.apply(this, arguments);
var option_size = this.nodeOptions.size;
if (option_size && option_size > 0) {
this.$el.attr("maxlength", option_size);
}
return def;
},
});
});