Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1584 Vizualizări

within /addons/web/static/src/legacy/js/fields/field_utils.js line 298 :

there is this function :
function formatX2Many(value) {
if (value.data.length === 0) {
return _t('No records');
} else if (value.data.length === 1) {
return _t('1 record');
} else {
return value.data.length + _t(' records');
}
}

i need to inherit/extend and change its functionality
odoo.define('mymodule.field_utils', function (require) {
"use strict";

var FieldUtils = require('web.field_utils');
var core = require('web.core');
var _t = core._t;



FieldUtils.include({
overridefunc: function(value) {
this._super.apply(this, arguments);


if (!value || !value.data || !value.data.length) {
return _t('No records');
} else if (value.data.length === 0) {
return _t('No records');
} else if (value.data.length === 1) {
return _t('1 record');
} else {
return value.data.length + _t(' records');
}
},
});
});

error : error while loading mymodule.field_utils: field_utils is not a function
similar errors due when i try extend


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mar. 15
6680
1
aug. 24
2507
1
mai 25
7674
1
nov. 24
3995
0
mai 24
1398