Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Need Help on Odoo WebClient Customisation

Odoberať

Get notified when there's activity on this post

This question has been flagged
mixinJS
2 Replies
5724 Zobrazenia
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
Zrušiť
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
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Why is my JS not working | Odoo 17
JS
Avatar
Avatar
1
júl 24
2672
GSAP LIBRARY
JS
Avatar
0
apr 24
2113
Mixins to extend existing models with fields and helper functions
mixin
Avatar
0
sep 18
6330
Dynamic Fields
fields mixin
Avatar
0
máj 25
1520
Database Manager unresponsive Solved
typeError JS
Avatar
Avatar
Avatar
2
feb 25
2057
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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