[FIX] web_hijri_datepicker: bug in list renderer
This commit is contained in:
parent
4816baee6d
commit
4d0ad29e1c
|
|
@ -72,7 +72,7 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
||||||
|
|
||||||
_renderBodyCell: function (record, node, colIndex, options) {
|
_renderBodyCell: function (record, node, colIndex, options) {
|
||||||
var tdClassName = 'o_data_cell';
|
var tdClassName = 'o_data_cell';
|
||||||
if (node.tag === 'button') {
|
if (node.tag === 'button_group') {
|
||||||
tdClassName += ' o_list_button';
|
tdClassName += ' o_list_button';
|
||||||
} else if (node.tag === 'field') {
|
} else if (node.tag === 'field') {
|
||||||
tdClassName += ' o_field_cell';
|
tdClassName += ' o_field_cell';
|
||||||
|
|
@ -92,13 +92,23 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
||||||
}
|
}
|
||||||
var $td = $('<td>', { class: tdClassName, tabindex: -1 });
|
var $td = $('<td>', { class: tdClassName, tabindex: -1 });
|
||||||
|
|
||||||
|
// We register modifiers on the <td> element so that it gets the correct
|
||||||
|
// modifiers classes (for styling)
|
||||||
var modifiers = this._registerModifiers(node, record, $td, _.pick(options, 'mode'));
|
var modifiers = this._registerModifiers(node, record, $td, _.pick(options, 'mode'));
|
||||||
|
// If the invisible modifiers is true, the <td> element is left empty.
|
||||||
|
// Indeed, if the modifiers was to change the whole cell would be
|
||||||
|
// rerendered anyway.
|
||||||
if (modifiers.invisible && !(options && options.renderInvisible)) {
|
if (modifiers.invisible && !(options && options.renderInvisible)) {
|
||||||
return $td;
|
return $td;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.tag === 'button') {
|
if (node.tag === 'button_group') {
|
||||||
return $td.append(this._renderButton(record, node));
|
for (const buttonNode of node.children) {
|
||||||
|
if (!this.columnInvisibleFields[buttonNode.attrs.name]) {
|
||||||
|
$td.append(this._renderButton(record, buttonNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $td;
|
||||||
} else if (node.tag === 'widget') {
|
} else if (node.tag === 'widget') {
|
||||||
return $td.append(this._renderWidget(record, node));
|
return $td.append(this._renderWidget(record, node));
|
||||||
}
|
}
|
||||||
|
|
@ -107,18 +117,20 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
||||||
return $td.append($el);
|
return $td.append($el);
|
||||||
}
|
}
|
||||||
this._handleAttributes($td, node);
|
this._handleAttributes($td, node);
|
||||||
|
this._setDecorationClasses($td, this.fieldDecorations[node.attrs.name], record);
|
||||||
|
|
||||||
var name = node.attrs.name;
|
var name = node.attrs.name;
|
||||||
var field = this.state.fields[name];
|
var field = this.state.fields[name];
|
||||||
if (field !== undefined) {
|
|
||||||
var value = record.data[name];
|
var value = record.data[name];
|
||||||
var formatter = field_utils.format[field.type];
|
var formatter = field_utils.format[field.type];
|
||||||
var formatOptions = {
|
var formatOptions = {
|
||||||
escape: true,
|
escape: true,
|
||||||
data: record.data,
|
data: record.data,
|
||||||
isPassword: 'password' in node.attrs,
|
isPassword: 'password' in node.attrs,
|
||||||
|
digits: node.attrs.digits && JSON.parse(node.attrs.digits),
|
||||||
};
|
};
|
||||||
var formattedValue = formatter(value, field, formatOptions);
|
var formattedValue = formatter(value, field, formatOptions);
|
||||||
|
var title = '';
|
||||||
if (_.contains(['date', 'datetime'], field.type) &&
|
if (_.contains(['date', 'datetime'], field.type) &&
|
||||||
(node.attrs.widget === 'hijri_date' || node.attrs.widget === 'hijri_datetime')) {
|
(node.attrs.widget === 'hijri_date' || node.attrs.widget === 'hijri_datetime')) {
|
||||||
if (formattedValue) {
|
if (formattedValue) {
|
||||||
|
|
@ -127,13 +139,9 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = '';
|
|
||||||
if (field.type !== 'boolean') {
|
if (field.type !== 'boolean') {
|
||||||
title = formatter(value, field, _.extend(formatOptions, {escape: false}));
|
title = formatter(value, field, _.extend(formatOptions, {escape: false}));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return $td.append(this._renderButton(record, node));
|
|
||||||
}
|
|
||||||
return $td.html(formattedValue).attr('title', title);
|
return $td.html(formattedValue).attr('title', title);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue