[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) {
|
||||
var tdClassName = 'o_data_cell';
|
||||
if (node.tag === 'button') {
|
||||
if (node.tag === 'button_group') {
|
||||
tdClassName += ' o_list_button';
|
||||
} else if (node.tag === 'field') {
|
||||
tdClassName += ' o_field_cell';
|
||||
|
|
@ -92,13 +92,23 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
|||
}
|
||||
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'));
|
||||
// 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)) {
|
||||
return $td;
|
||||
}
|
||||
|
||||
if (node.tag === 'button') {
|
||||
return $td.append(this._renderButton(record, node));
|
||||
if (node.tag === 'button_group') {
|
||||
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') {
|
||||
return $td.append(this._renderWidget(record, node));
|
||||
}
|
||||
|
|
@ -107,18 +117,20 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
|||
return $td.append($el);
|
||||
}
|
||||
this._handleAttributes($td, node);
|
||||
this._setDecorationClasses($td, this.fieldDecorations[node.attrs.name], record);
|
||||
|
||||
var name = node.attrs.name;
|
||||
var field = this.state.fields[name];
|
||||
if (field !== undefined) {
|
||||
var value = record.data[name];
|
||||
var formatter = field_utils.format[field.type];
|
||||
var formatOptions = {
|
||||
escape: true,
|
||||
data: record.data,
|
||||
isPassword: 'password' in node.attrs,
|
||||
digits: node.attrs.digits && JSON.parse(node.attrs.digits),
|
||||
};
|
||||
var formattedValue = formatter(value, field, formatOptions);
|
||||
|
||||
var title = '';
|
||||
if (_.contains(['date', 'datetime'], field.type) &&
|
||||
(node.attrs.widget === 'hijri_date' || node.attrs.widget === 'hijri_datetime')) {
|
||||
if (formattedValue) {
|
||||
|
|
@ -127,13 +139,9 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
|
|||
}
|
||||
}
|
||||
|
||||
var title = '';
|
||||
if (field.type !== 'boolean') {
|
||||
title = formatter(value, field, _.extend(formatOptions, {escape: false}));
|
||||
}
|
||||
} else {
|
||||
return $td.append(this._renderButton(record, node));
|
||||
}
|
||||
return $td.html(formattedValue).attr('title', title);
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue