[IMP] Now the Many2OneButton accepts an option (label) containing a dict 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
This commit is contained in:
vta vta@openerp.com
2012-11-07 11:34:26 +01:00
parent 83405dba45
commit 4b0d99d6c8
+6 -1
View File
@@ -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);