2

When i redirect my page using self.do_action in odoo(openERP7) it is not loading Data Tables in the new page. In other pages it was working fine. But in a particular page if i redirect using this self.do_action is not working. But self.act_window is working fine in the same page.

If any one faced this same issue please let me know.

Update:I found a similarity of problems in my code. I have a model like performance.review and some other models also. All the self.do_action used in this model is not loading Data tables properly. But other model screens does perfectly. Is there any relation between model extension and using self.do_action? Here is my code,

module.ReviewForm= instance.web.Widget.extend({
    events: {
        'click #review_tree_view':'load_tree_view',
    },

load_tree_view: function (event) {
        var self = this;
        self.do_action({
            type: 'ir.actions.client',
            tag: "performance.review",
            name:'Tree view',
            target: 'current',
        });
    },
4

2 回答 2

0

其实这是我自己犯的一个小错误。我对许多 qweb 屏幕使用相同的模型,并且每次我使用渲染表单视图时都self.do_action没有清空现有的树视图。

通过添加此行可以轻松完成。现在数据表正确且完美地加载。

load_tree_view: function (event) {
    var self = this;

    self.$el.empty();

    self.do_action({
        type: 'ir.actions.client',
        tag: "performance.review",
        name:'Tree view',
        target: 'current',
    });
},
于 2015-10-12T13:32:08.587 回答
0

在 javascript 文件中,您可以将事件添加到按钮类名称,如下所示:

bind_events: function () {            
        this.$('.oe_btn_class_name').on('click', this.on_call_new_view_function);
    },

然后在点击事件发生时调用“on_call_new_view_function”并打开新视图,如下所示:

on_call_new_view_function: function () {
        var self = this;
        // you can pass in other data using the context dictionary variable
        var context = {
            'id': this.id,
        };
        // the action dictionary variable sends data in the "self.do_action" method
        var action = {
                type: 'ir.actions.act_window',
                res_model: 'model.name',
                view_id: 'view_id',
                view_mode: 'form',
                view_type: 'form',
                views: [[false, 'form']],
                target: 'new',
                context: context,
        };
        // self.do_action accepts the action parameter and opens the new view
        self.do_action(action);
    },
于 2015-10-12T09:07:24.713 回答