[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
|
||||
*/
|
||||
format: function (row_data, options) {
|
||||
return _.template('<button type="button" title="<%-title%>" <%=additional_attributes%> >' +
|
||||
'<img src="<%-prefix%>/web/static/src/img/icons/<%-icon%>.png" alt="<%-alt%>"/>' +
|
||||
'</button>', {
|
||||
title: this.string || '',
|
||||
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"' : '',
|
||||
prefix: instance.session.prefix,
|
||||
icon: this.icon,
|
||||
alt: this.string || ''
|
||||
});
|
||||
options = options || {};
|
||||
var attrs = {};
|
||||
if (options.process_modifiers !== false) {
|
||||
attrs = this.modifiers_for(row_data);
|
||||
}
|
||||
if (attrs.invisible) { return ''; }
|
||||
|
||||
return QWeb.render('ListView.row.button', {
|
||||
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({
|
||||
|
|
|
@ -702,6 +702,11 @@
|
|||
</span>
|
||||
</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">
|
||||
<!-- adds back padding to row being rendered after edition, if necessary
|
||||
(if not deletable add back padding), otherwise the row being added is
|
||||
|
|
Loading…
Reference in New Issue