[FIX] correctly implement handling of modifiers on buttons in list views
bzr revid: xmo@openerp.com-20120928121747-9s78qov8x0zfrbl5
This commit is contained in:
parent
6f16fc3df9
commit
6159063ae0
|
@ -2074,16 +2074,20 @@ instance.web.list.Button = instance.web.list.Column.extend({
|
||||||
* Return an actual ``<button>`` tag
|
* Return an actual ``<button>`` tag
|
||||||
*/
|
*/
|
||||||
format: function (row_data, options) {
|
format: function (row_data, options) {
|
||||||
return _.template('<button type="button" title="<%-title%>" <%=additional_attributes%> >' +
|
options = options || {};
|
||||||
'<img src="<%-prefix%>/web/static/src/img/icons/<%-icon%>.png" alt="<%-alt%>"/>' +
|
var attrs = {};
|
||||||
'</button>', {
|
if (options.process_modifiers !== false) {
|
||||||
title: this.string || '',
|
attrs = this.modifiers_for(row_data);
|
||||||
additional_attributes: isNaN(row_data["id"].value) && instance.web.BufferedDataSet.virtual_id_regex.test(row_data["id"].value) ?
|
}
|
||||||
'disabled="disabled" class="oe_list_button_disabled"' : '',
|
if (attrs.invisible) { return ''; }
|
||||||
prefix: instance.session.prefix,
|
|
||||||
icon: this.icon,
|
return QWeb.render('ListView.row.button', {
|
||||||
alt: this.string || ''
|
widget: this,
|
||||||
});
|
prefix: instance.session.prefix,
|
||||||
|
disabled: attrs.readonly
|
||||||
|
|| isNaN(row_data.id.value)
|
||||||
|
|| instance.web.BufferedDataSet.virtual_id_regex.test(row_data.id.value)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
instance.web.list.Boolean = instance.web.list.Column.extend({
|
instance.web.list.Boolean = instance.web.list.Column.extend({
|
||||||
|
|
|
@ -702,6 +702,11 @@
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
<button t-name="ListView.row.button" type="button"
|
||||||
|
t-att-title="widget.string" t-att-disabled="disabled || undefined"
|
||||||
|
t-att-class="disabled ? 'oe_list_button_disabled' : undefined"
|
||||||
|
><img t-attf-src="#{prefix}/web/static/src/img/icons/#{widget.icon}.png"
|
||||||
|
t-att-alt="widget.string" /></button>
|
||||||
<t t-extend="ListView.row">
|
<t t-extend="ListView.row">
|
||||||
<!-- adds back padding to row being rendered after edition, if necessary
|
<!-- adds back padding to row being rendered after edition, if necessary
|
||||||
(if not deletable add back padding), otherwise the row being added is
|
(if not deletable add back padding), otherwise the row being added is
|
||||||
|
|
Loading…
Reference in New Issue