0
votes

JS code

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;
});

When I tried to open the menu in Odoo 13, console gave "Could not find client action org_chart_department Object { id: 161, name: "Employee Chart", type: "ir.actions.client", tag: "org_chart_department", target: "current", res_model: false, context: {…}, params: false, params_store: false, xml_id: "org_chart_employee.action_org_chart_employee", … }" it appeared " res_model: false" How to resolve that?

2

2 Answers

0
votes

Libyan Zaroog,

Did you make the client action Like this,

<record id="action_id" model="ir.actions.client">
    <field name="name">Name</field>
    <field name="res_model">Model</field>
    <field name="tag">Your Registry Add[org_chart_department]</field>
</record>

For Referrence just check the below link,

account_view & reconciliation_action

Thanks

0
votes

Thanks Dipen Shah it helps. I was appeared the js function did not start with odoo.define() but it resolved.