[fix] problem with list view in o2m and buttons that should be disabled in some cases

lp bug: https://launchpad.net/bugs/884207 fixed

bzr revid: nicolas.vanhoren@openerp.com-20111222124913-fezv69rxh7xoulkm
This commit is contained in:
niv-openerp 2011-12-22 13:49:13 +01:00
commit e05b605dca
2 changed files with 14 additions and 7 deletions

View File

@ -894,6 +894,10 @@ label.error {
opacity: 0.75;
}
.openerp .oe-listview .oe-field-cell .oe-listview-button-disabled img {
opacity: 0.5;
}
.openerp .oe-listview th.oe-actions {
text-align: left;
white-space: nowrap;

View File

@ -252,14 +252,17 @@ openerp.web.format_cell = function (row_data, column, value_if_empty, process_mo
}
if (attrs.invisible) { return ''; }
if (column.tag === 'button') {
return [
'<button type="button" title="', column.string || '', '">',
'<img src="', openerp.connection.prefix, '/web/static/src/img/icons/', column.icon, '.png"',
' alt="', column.string || '', '"/>',
'</button>'
].join('')
return _.template('<button type="button" title="<%-title%>" <%=additional_attributes%> >' +
'<img src="<%-prefix%>/web/static/src/img/icons/<%-icon%>.png" alt="<%-alt%>"/>' +
'</button>', {
title: column.string || '',
additional_attributes: isNaN(row_data["id"].value) && openerp.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value) ?
'disabled="disabled" class="oe-listview-button-disabled"' : '',
prefix: openerp.connection.prefix,
icon: column.icon,
alt: column.string || '',
});
}
if (!row_data[column.id]) {
return value_if_empty === undefined ? '' : value_if_empty;
}