Hi!
I was trying to get a better understanding of the intepretation of the XML attributes and how, when and why odoo properly evaluates expressions inside those attributes. Then I found this function:
https://github.com/odoo/odoo/blob/a463a8718979581bbaec1e2a67edfded6ba35ffc/addons/web/static/src/js/views/basic/basic_model.js#L2090
/**
* Evaluate modifiers
*
* @private
* @param {Object} element a valid element object, which will serve as eval
* context.
* @param {Object} modifiers
* @returns {Object}
*/
_evalModifiers: function (element, modifiers) {
var result = {};
var self = this;
var evalContext;
function evalModifier(mod) {
if (mod === undefined || mod === false || mod === true) {
return !!mod;
}
evalContext = evalContext || self._getEvalContext(element);
return new Domain(mod, evalContext).compute(evalContext);
}
if ('invisible' in modifiers) {
result.invisible = evalModifier(modifiers.invisible);
}
if ('column_invisible' in modifiers) {
result.column_invisible = evalModifier(modifiers.column_invisible);
}
if ('readonly' in modifiers) {
result.readonly = evalModifier(modifiers.readonly);
}
if ('required' in modifiers) {
result.required = evalModifier(modifiers.required);
}
return result;
},
Is there ANY special reason why to hard-code these specific modifiers ?