JS代码
var employee_data = [];
var nodeTemplate = function(data) {
return `
<span class="office">${data.office}</span>
<div class="title">${data.name}</div>
<div class="content">${data.title}</div>
`;
};
odoo.define("org_chart_employee.org_chart_employee", function (require) {
"use strict";
var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var session = require('web.session');
var ajax = require('web.ajax');
var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin');
var QWeb = core.qweb;
var _t = core._t;
var _lt = core._lt;
var OrgChartDepartment = AbstractAction.extend({
init: function(parent, context) {
this._super(parent, context);
var self = this;
if (this.action.tag == 'org_chart_department') {
self._rpc({
model: 'org.chart.employee',
method: 'get_employee_data',
}).then(function(result){
employee_data = result;
}).done(function(){
self.render();
self.href = window.location.href;
});
}
},
willStart: function() {
return $.when(ajax.loadLibs(this), this._super());
},
start: function() {
var self = this;
return this._super();
},
render: function() {
var self = this;
var org_chart = QWeb.render('org_chart_employeeOrg_chart_template', {
widget: self,
});
$( ".o_control_panel" ).addClass( "o_hidden" );
$(org_chart).prependTo(self.$el);
return org_chart;
},
reload: function () {
window.location.href = this.href;
},
});
core.action_registry.add('org_chart_department', OrgChartDepartment);
return OrgChartDepartment;
});
当我尝试在 Odoo 13 中打开菜单时,控制台给出“找不到客户端操作 org_chart_department 对象 { id:161,名称:“员工图表”,类型:“ir.actions.client”,标签:“org_chart_department”,目标: "current", res_model: false, context: {...}, params: false, params_store: false, xml_id: "org_chart_employee.action_org_chart_employee", ... }" 它出现了 " res_model: false" 如何解决?