Odoo中文网|Odoo实施培训

 找回密码
 立即注册
搜索
热搜: Odoo OpenERP 实施
查看: 5400|回复: 0

odoo 通过 JS 调用 RPC

[复制链接]

14

主题

31

帖子

125

积分

注册会员

Rank: 2

积分
125
发表于 2018-1-3 10:11:31 | 显示全部楼层 |阅读模式
本帖最后由 小不点 于 2018-1-3 10:15 编辑

Remote Procedure Call (RPC)Call method/**
* Call a method (over RPC) on the bound OpenERP model.
*
* @param {String} method name of the method to call
* @param {Array} [args] positional arguments
* @param {Object} [kwargs] keyword arguments
* @param {Object} [options] additional options for the rpc() method * @returns {jQuery.Deferred<>} call result
*/
call: function (method, args, kwargs, options) {   
      args = args || [];   
      kwargs = kwargs || {};   
      if (!_.isArray(args)) {      
             // call(method, kwargs)      
             kwargs = args;      
             args = [];   
     }   
     var call_kw = '/web/dataset/call_kw/' + this.name + '/' + method;   
     return session.rpc(call_kw, {      
       model: this.name,      
      method: method,        
      args: args,        
     kwargs: kwargs    },
    options);
    },


How to call wizard method from js
var compose_model = new Model('mail.compose.message');
     return compose_model.call('create', [msg, {default_parent_id: options.parent_id}])   
         .then(function(id){        
             return compose_model.call('send_mail_action', [id, {}]);   
      });





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|技术支持|开发手册|Odoo中文网-远鼎旗下odoo培训网站 ( 苏ICP备15039516号 )

GMT+8, 2024-3-29 00:50 , Processed in 0.010462 second(s), 9 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表