Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Need Help on Odoo WebClient Customisation

Subscriure's

Get notified when there's activity on this post

This question has been flagged
mixinJS
2 Respostes
5736 Vistes
Avatar
Harinath Srinivasan

Hello, Everyone,

I'm new to Odoo Framework I have requirements as follows

I should not expose any model information in js. like I should not call using RPC.query everything should route via the handler.

From Controller am recieving data in json format:

As a new view, I try to create with the following code in JS

JS:-

odoo.define('web_hospital_dashboard.datatable', function (require) {
"use strict"
var core = require('web.core');
var Widget = require('web.Widget');
var rpc = require('web.rpc');
var qweb = core.qweb;
var ajax = require('web.ajax');
ajax.loadXML('/web_corona_dashboard/static/src/xml/datatable.xml', qweb);
var ActionManager = require('web.ActionManager');
var view_registry = require('web.view_registry');
var AbstractAction = require('web.AbstractAction');
var result = [];

var hospital_datatable=Widget.extend({

template :'hospital_datatable',

init: function (parent) {
this._super(parent);

},
willStart: function(){

ajax.jsonRpc("/hospital/get_data", 'call', {}, {
'async': false
}).then(function (data) {
var parseData=JSON.parse(data)
result.push(parseData);
});

},
start: function () {
console.log("Widget rendered")


console.log("got the result",result)
$('#hospital_table').DataTable( {

data: result,
columns: [
{ data: 'name' },
{ data: 'type_of_hospital' },
{ data: 'isFunction' },
{ data: 'isApproved' }]
}
);


},});
console.log("Trying to add Action");
var Test_Client = AbstractAction.extend({
template: 'hospital_datatable',

init: function() {
console.log("Action Function is intialized");
},});

core.action_registry.add("web_covid_view_main",Test_Client);
return Test_Client;
});

My xml template:-

<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="hospital_datatable">
<div>
<table id="hospital_table" class="table table-stripped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Type Of Hospital</th>
<th>is Function</th>
<th>Is Approved.</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Type Of Hospital</th>
<th>is Function</th>
<th>Is Approved.</th>
</tr>
</tfoot>
</table>
</div>
</t>
</templates>

Added Asset:-

<odoo>
<template id="asset_backend" name="Web Home view assets" inherit_id="web.assets_backend" priority="17">
<xpath expr="." position="inside">
<script type="text/javscript" src="/web_corona_dashboard/static/src/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javscript" src="/web_hospital_dashboard/static/src/js/jquery.dataTables.min.js"></script>
<script type="text/javscript" src="/web_hospital_dashboard/static/src/js/datatable.js"></script>
</xpath>
</template>
</odoo>

 Facing Following issue:-

Uncaught TypeError: d is undefined
    <anonymous> http://localhost:8089/web_hospital_dashboard/static/src/js/dataTables.bootstrap4.min.js:8
    <anonymous> http://localhost:8089/web_hospital_dashboard/static/src/js/dataTables.bootstrap4.min.js:8
    <anonymous> http://localhost:8089/web_hospital_dashboard/static/src/js/dataTables.bootstrap4.min.js:8
dataTables.bootstrap4.min.js:8:348

Second Issue

Uncaught TypeError: self.__edispatcherEvents is undefined

    on http://localhost:8089/web/static/src/js/core/mixins.js:297

    forEach Underscore

    on http://localhost:8089/web/static/src/js/core/mixins.js:296

    _startController http://localhost:8089/web/static/src/js/chrome/action_manager.js:907

    _executeAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:343

    jQuery 8

    _executeAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:334

    _executeClientAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:488

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:689

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager_report.js:163

    OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8089/web/static/src/js/core/class.js:123

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager_act_window.js:488

    OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8089/web/static/src/js/core/class.js:123

    doAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:179

    jQuery 21

    genericJsonRpc http://localhost:8089/web/static/src/js/core/ajax.js:65

    jQuery 8

mixins.js:297:13

    on http://localhost:8089/web/static/src/js/core/mixins.js:297

    forEach Underscore

    on http://localhost:8089/web/static/src/js/core/mixins.js:296

    _startController http://localhost:8089/web/static/src/js/chrome/action_manager.js:907

    _executeAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:343

    jQuery 8

    _executeAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:334

    _executeClientAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:488

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:689

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager_report.js:163

    OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8089/web/static/src/js/core/class.js:123

    _handleAction http://localhost:8089/web/static/src/js/chrome/action_manager_act_window.js:488

    OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8089/web/static/src/js/core/class.js:123

    doAction http://localhost:8089/web/static/src/js/chrome/action_manager.js:179

    jQuery 11

    <anonymous> self-hosted:844

    jQuery 10

    genericJsonRpc http://localhost:8089/web/static/src/js/core/ajax.js:65

    jQuery 8

If Anyone Helps me it will so helpful and explain the flow of creating a custom widget that also will help.

0
Avatar
Descartar
Avatar
Harinath Srinivasan
Autor Best Answer

Hi axel, am low in karma so replying in copy-paste error its core registry.action_registry.add only and this error from developer mode with asset am unable to delete this one so updating here Second Issue which I mentioned is clear after I added empty events which is a dictionary type

0
Avatar
Descartar
Axel Mendoza

Try editing your own question

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Why is my JS not working | Odoo 17
JS
Avatar
Avatar
1
de jul. 24
2677
GSAP LIBRARY
JS
Avatar
0
d’abr. 24
2117
Mixins to extend existing models with fields and helper functions
mixin
Avatar
0
de set. 18
6336
Dynamic Fields
fields mixin
Avatar
0
de maig 25
1533
Database Manager unresponsive Solved
typeError JS
Avatar
Avatar
Avatar
2
de febr. 25
2059
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now