~openerp-dev/openerp-web/7.0-opw-605557-fka

« back to all changes in this revision

Viewing changes to addons/web/static/src/js/data_export.js

  • Committer: Martin Trigaux
  • Date: 2014-03-05 10:08:43 UTC
  • mfrom: (3978.1.1 7.0)
  • Revision ID: mat@openerp.com-20140305100843-ircqtucf1pkn3wzd
[MERGE] [FIX] export wizard: better behaviour when saving new fields list

- Show the fields list once we save the first one
- When delete a list, remove the selected fields
- When add a list, do not remove the selected fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
                if (select_exp.val()) {
102
102
                    self.exports.unlink([parseInt(select_exp.val(), 10)]);
103
103
                    select_exp.remove();
 
104
                    self.$el.find("#fields_list option").remove();
104
105
                    if (self.$el.find('#saved_export_list option').length <= 1) {
105
106
                        self.$el.find('#ExistsExportList').hide();
106
107
                    }
148
149
            export_fields: _(fields).map(function (field) {
149
150
                return [0, 0, {name: field}];
150
151
            })
151
 
        }, function (export_list_id) {
152
 
            if (!export_list_id.result) {
 
152
        }).then(function (export_list_id) {
 
153
            if (!export_list_id) {
153
154
                return;
154
155
            }
155
 
            self.$el.find("#saved_export_list").append(
156
 
                    new Option(value, export_list_id.result));
157
 
            if (self.$el.find("#saved_export_list").is(":hidden")) {
 
156
            if (!self.$el.find("#saved_export_list").length || self.$el.find("#saved_export_list").is(":hidden")) {
158
157
                self.show_exports_list();
159
158
            }
 
159
            self.$el.find("#saved_export_list").append( new Option(value, export_list_id) );
160
160
        });
161
161
        this.on_show_save_list();
162
 
        this.$el.find("#fields_list option").remove();
163
162
    },
164
163
    on_click: function(id, record) {
165
164
        var self = this;