summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/static/src
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-04-15 14:52:22 +0200
committerThibault Delavallée <tde@openerp.com>2014-04-15 14:52:22 +0200
commit4808ca3796514701dc20a0ef96cddeedbf61e90d (patch)
tree0c5429016fd28d41f49c718c2f9de9e79fd27369 /addons/mass_mailing/static/src
parentea2e59f86bf76787415ce5e637465335bff9de16 (diff)
[FIX] mass_mailing: various fixed in chardomain widget
bzr revid: tde@openerp.com-20140415125222-uzvzgzo5gx6hmgor
Diffstat (limited to 'addons/mass_mailing/static/src')
-rw-r--r--addons/mass_mailing/static/src/js/mass_mailing.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/addons/mass_mailing/static/src/js/mass_mailing.js b/addons/mass_mailing/static/src/js/mass_mailing.js
index a033903ef7a..c91fe900923 100644
--- a/addons/mass_mailing/static/src/js/mass_mailing.js
+++ b/addons/mass_mailing/static/src/js/mass_mailing.js
@@ -11,32 +11,32 @@ openerp.mass_mailing = function (instance) {
},
});
- instance.web.form.CharDomainButton = instance.web.form.AbstractField.extend({
- template: 'CharDomainButton',
+ instance.web.form.CharDomainButton = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
init: function(field_manager, node) {
this._super.apply(this, arguments);
},
- initialize_content: function () {
- this.on("change:effective_readonly", this, this.render_value);
- },
start: function() {
var self=this;
this._super.apply(this, arguments);
- $('button.select_records', this.$el).on('click', self.on_click);
- this.set_button();
+ this.on("change:effective_readonly", this, function () {
+ this.display_field();
+ this.render_value();
+ });
+ this.$('button.select_records').on('click', self.on_click);
+ this.display_field();
+ return this._super();
},
- render_value: function () {
- console.log('cacaprout', this.$('.select_records'));
- var self = this;
- this.$('.select_records').toggle(! this.get('effective_readonly'));
+ render_value: function() {
+ this.$('button.select_records').css('visibility', this.get('effective_readonly') ? 'hidden': '');
},
set_value: function(value_) {
var self = this;
this.set('value', value_ || false);
- this.set_button();
+ this.display_field();
},
- set_button: function() {
+ display_field: function() {
var self = this;
+ this.$el.html(instance.web.qweb.render("CharDomainButton", {widget: this}));
if (this.get('value')) {
var domain = instance.web.pyeval.eval('domain', this.get('value'));
var relation = this.getParent().fields.mailing_model.get('value')[0];
@@ -51,7 +51,6 @@ openerp.mass_mailing = function (instance) {
};
},
on_click: function(ev) {
- console.log(this.get('effective_readonly'));
var self = this;
var model = this.options.model || this.field_manager.get_field_value(this.options.model_field);
this.pop = new instance.web.form.SelectCreatePopup(this);