From 4b0d99d6c861b171d84d816bafffb35ada699a82 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 7 Nov 2012 11:34:26 +0100 Subject: [PATCH] [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 --- addons/web/static/src/js/view_form.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 20024c076f5..1b5ca8de730 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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);