Hello I'm trying to pass my active_id from my res.partner to the JS.
(您好,我正在尝试将我的active_id从我的res.partner传递给JS。)
But no luck.(但是没有运气。)
I tried with dataset active_id but it's always undefined.(我尝试使用数据集active_id,但始终未定义。)
and i can't find any solution in the docs.(而且我在文档中找不到任何解决方案。)
Here's my JS File:(这是我的JS文件:)
odoo.define('melax_category.my_dialog_partner', function(require){"user strict";
var core = require('web.core');
var session = require('web.session');
var qweb = core.qweb;
var mixins = core.mixins;
// var Widget = require('web.Widget');
var Model = require('web.Model');
var Dialog = require('web.Dialog');
var model_category = new Model('res.partner');
// var dataset = this.dataset;
// var active_id = dataset.ids[dataset.index];
function ActionBuildTreeBuyerPartner(parent, action){
console.log(this.id)
var dialog = new Dialog(document.body, {
title: "Categories Web Acheteur",
subtitle: '<input id="search-tree-buyer" type="text">',
size: 'big',
$content: '
<div id="tree-buyer-container"></div>
',
});
TREE = $('#tree-buyer-container')
dialog.open();
DESTROY_TREE($('#tree-buyer-container'))
BUILD_TREE_PARTNER_MODE(model_category, $('#tree-buyer-container'))
}
function ActionBuildTreeSellerPartner(parent, action){
var dialog = new Dialog(document.body, {
title: "Categories Web Vendeur",
// subtitle: "Tree Builder Partner Sub Title!",
size: 'big',
$content: '<div id="tree-seller-container"></div>',
});
TREE = $('#tree-seller-container')
dialog.open();
// DESTROY_TREE($('#tree-seller-container'))
// BUILD_TREE_PARTNER_MODE(model_category, $('#tree-buyer-container'))
}
core.action_registry.add("build_tree_buyer_partner", ActionBuildTreeBuyerPartner);
core.action_registry.add("build_tree_seller_partner", ActionBuildTreeSellerPartner);
});
and here's my python file where for example i'm trying to pass my active_id(self.id):
(这是我的python文件,例如,我正在尝试传递我的active_id(self.id):)
@api.multi
def build_tree_buyer_partner(self):
_logger.error(self)
# My active Id
_logger.error(self.id)
return {
'type':'ir.actions.client',
'tag': 'build_tree_buyer_partner'
}
ask by Ahmed Hached translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…