Skip to Content
Menu
This question has been flagged
1762 Views

I try to modify web_export_view to export only some of fields, any idea what should I put down where indicated:


openerp.web_export_view = function (instance) {


    var _t = instance.web._t, QWeb = instance.web.qweb;


    instance.web.Sidebar.include({

        redraw: function () {

            var self = this,

                view_manager = self.getParent() && self.getParent().ViewManager,

                view_name = view_manager && view_manager.active_view,

                active_view = view_name && view_manager.views[view_name];

            this._super.apply(this, arguments);

            if (active_view && active_view.controller instanceof instance.web.ListView) {

                self.$el.find('.oe_sidebar').append(QWeb.render('AddExportViewMain', {widget: self}));

                self.$el.find('.oe_sidebar_export_view_xls').on('click', self.on_sidebar_export_view_xls);

            }

        },


        on_sidebar_export_view_xls: function (e, active_domain) {

            // Select the first list of the current (form) view

            // or assume the main view is a list view and use that

            var self = this,

                view = this.getParent(),

                fields_view = view.fields_view,

                children = view.getChildren(),

                deferred = new jQuery.Deferred();

            if (children) {

                children.every(function (child) {

                    if (child.field && child.field.type == 'one2many') {

                        view = child.viewmanager.views.list.controller;

                        return false; // break out of the loop

                    }

                    if (child.field && child.field.type == 'many2many') {

                        view = child.list_view;

                        return false; // break out of the loop

                    }

                    return true;

                });

            }

            export_columns_keys = [];

            export_columns_names = [];

            $.each(view.visible_columns, function () {

                if (this.tag == 'field') {


                    if(  _____________________?name == 'date_order')   <------------------ ???


                    // non-fields like `_group` or buttons

                    export_columns_keys.push(this.id);

                    export_columns_names.push(this.string);

                }

            });

.....

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 23
2929
1
Dec 24
115
0
Dec 24
59
2
Nov 24
82
1
Oct 24
257