Skip to content

Commit

Permalink
[IMP] Now the Many2OneButton accepts an option (label) containing a d…
Browse files Browse the repository at this point in the history
…ict to set the string displayed in the button ({'create':String, 'edit':String}). If no label, the string is empty.

bzr revid: vta@openerp.com-20121107103426-u6dfd1vcfu8fwap3
  • Loading branch information
vta vta@openerp.com committed Nov 7, 2012
1 parent 83405db commit 4b0d99d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addons/web/static/src/js/view_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,12 @@ instance.web.form.Many2OneButton = instance.web.form.AbstractField.extend({
if (this.$button) {
this.$button.remove();
}
this.string = this.get('value') ? _t('Edit') : _t('Create');
var options =py.eval(this.node.attrs.options);
if (options.label) {
this.string = this.get('value') ? _t(options.label.edit) : _t(options.label.create);
} else {
this.string = '';
}
this.node.attrs.icon = this.get('value') ? '/web/static/src/img/icons/gtk-yes.png' : '/web/static/src/img/icons/gtk-no.png';
this.$button = $(QWeb.render('WidgetButton', {'widget': this}));
this.$el.append(this.$button);
Expand Down

0 comments on commit 4b0d99d

Please sign in to comment.