This question has been flagged

Hi,

I am working on an addon that use do_action like following code. This code is used template at standard Odoo V13. domain is used for filtering and not gives a return in this case.

get_model_info: function (params, evt) {
    var model = this._action.res_model,
    self = this;
    this._rpc({
            model:'ir.model',
            method:'search',
            args: [[['model', '=', model]]]
         }).then(function (ids) {
                self.do_action({
                    res_model:'model_info_model',
                    context: {'default_type':'model', 'default_model_id':ids[0]},
                    name:_t('View Info'),
                    views: [[false, 'form']],
                    view_mode:'form',
                    target:'new',
                    domain: [['model_id', '=', ids[0]]],
                    type:'ir.actions.act_window',
             });
                });
            },

This code is not bringing any data just opens a blank form. If I change the code like below it works but I could not have model_id id and couldn't use context in do_action.


get_model_info:
    function (params, evt) {
        var model = this._action.res_model,
        self = this;        
        this._rpc({model:'model_info_model',
            method:'search',
            args: [[['type','=','model'],['model_id.model', '=', this._action.res_model]]]
         }).then(function (ids) {
                            self.do_action({
                                res_model:'model_info_model',
                                res_id:ids[0],
                                context: {'default_type':'model', 'default_model_id':'bank'},
                                name:_t('View Help'),
                                views: [[false, 'form']],
                                view_mode:'form',
                                target:'new',
                                type:'ir.actions.act_window',
                     });
                     });
                     },

I tried ['id', '=' ,ids[0]] at domain in second code and it does not work either.

I only could use res_id.

Any ideas?

Avatar
Discard