Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

Modules are needed by other modules but have not been defined / Modules could not be loaded because they have unmet dependencies

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
javascriptv17
2 Besvarelser
7662 Visninger
Avatar
Jay

Hello,
I am getting this error in this javascript desipite importing the necessary modules.
What could be the issue here?

The following modules are needed by other modules but have not been defined, they may not be present in the correct asset bundle:

  • web.core

The following modules could not be loaded because they have unmet dependencies, this is a secondary error which is likely caused by one of the above problems:

  • @dynamic_access_rights/js/crawler


Here is my code:

/** @odoo-module **/

import { jsonrpc } from "@web/core/network/rpc_service";

odoo.define("dynamic_access_rights.core", (require) => {
"use strict";

const { Component } = owl;
const { xml } = owl.tags;
const { whenReady } = owl.utils;

//const { jsonRpc } = require('web.core'); // Ensure web.core is imported



class DynamicAccessRights extends Component {
constructor() {
super(...arguments);
this.dynamics = null;
}

async willStart() {
const data = await jsonRpc("/fetch-dynamic-objects", "call", {});
this.dynamics = data;
}

updateButtons(targetButtons) {
for (const button of targetButtons) {
const klas = `dynamics-${button.restriction}`;
const name = button.name;
const buttons1 = this.el.querySelectorAll(`button[name='${name}']`);
const buttons2 = this.el.querySelectorAll(`.${name}`);
buttons1.forEach((button) => button.classList.add(klas));
buttons2.forEach((button) => button.classList.add(klas));
}
}

updatePages(targetPages) {
for (const page of targetPages) {
const klas = `dynamics-${page.restriction}`;
const name = page.name;
const anchors = this.el.querySelectorAll("a[role='tab']");
anchors.forEach((anchor) => {
if (anchor.textContent.toLowerCase() === name.toString().toLowerCase()) {
const pageId = anchor.getAttribute('href');
anchor.classList.add(klas);
this.el.querySelector(`${pageId}`).classList.add(klas);
}
});
}
}

refreshRights() {
const urlString = window.location.href.split('#')[1];
const params = new URLSearchParams(urlString);
const activeModel = params.get('model');
const data = this.dynamics[activeModel];
if (data && data['buttons']) {
this.updateButtons(data['buttons']);
}
if (data && data['pages']) {
this.updatePages(data['pages']);
}
}

mounted() {
this.intervalId = setInterval(this.refreshRights.bind(this), 500);
}

willUnmount() {
clearInterval(this.intervalId);
}
}

DynamicAccessRights.template = xml`

`;

whenReady(DynamicAccessRights);

return DynamicAccessRights;
});


0
Avatar
Kassér
Jay
Forfatter

Hi, @Cybrosys your solution eliminated one of the errors but I am getting this error now.
I have updated the code above with your solution.

Kindly advise:

Uncaught Error: Error while loading "@dynamic_access_rights/js/crawler":
Error: Dependencies should be defined by an array: (require)=>{"use strict";const{Component,hooks}=owl;const{useService}=owl.hooks;let dynamics=null;class DynamicAccessRights extends Component{constructor(){super(...arguments);this.dynamics=useService("dynamicAccessRights");}
async willStart(){const data=await jsonRpc("/fetch-dynamic-objects","call",{});this.dynamics=data;}
updateButtons(targetButtons){for(const button of targetButtons){const klas=`dynamics-${button.restriction}`;const name=button.name;const buttons1=this.el.querySelectorAll(`button[name='${name}']`);const buttons2=this.el.querySelectorAll(`.${name}`);buttons1.forEach((button)=>button.classList.add(klas));buttons2.forEach((button)=>button.classList.add(klas));}}
updatePages(targetPages){for(const page of targetPages){const klas=`dynamics-${page.restriction}`;const name=page.name;const anchors=this.el.querySelectorAll("a[role='tab']");anchors.forEach((anchor)=>{if(anchor.textContent.toLowerCase()===name.toString().toLowerCase()){const pageId=anchor.getAttribute('href');anchor.classList.add(klas);this.el.querySelector(`${pageId}`).classList.add(klas);}});}}
refreshRights(){const urlString=window.location.href.split('#')[1];const params=new URLSearchParams(urlString);const activeModel=params.get('model');const data=this.dynamics[activeModel];if(data&&data['buttons']){this.updateButtons(data['buttons']);}
if(data&&data['pages']){this.updatePages(data['pages']);}}
mounted(){this.intervalId=setInterval(this.refreshRights.bind(this),500);}
willUnmount(){clearInterval(this.intervalId);}}
DynamicAccessRights.template=owl.tags.xml`<div></div>`;hooks.whenReady(DynamicAccessRights);return DynamicAccessRights;}

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar

Hi,

In Odoo 17 the OWL js method is mostly using in the JS codes. Currently You are using the Back bone method. So please try to migrate the code to OWL method and try it again
You can refer the below blog to get an idea on OWL:
An overview of owl component in odoo


Hope it helps

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Odoo 17, the following modules are needed by other modules but have not been defined, they may not be present in the correct asset bundle.
javascript v17
Avatar
Avatar
Avatar
Avatar
Avatar
4
maj 25
11448
where can i find the web.core and qweb.core in Odoo17? Løst
javascript v17
Avatar
Avatar
Avatar
Avatar
3
apr. 24
7577
add a custom code when form view is loaded in odoo 17 Løst
javascript v17
Avatar
1
jan. 24
5237
UncaughtPromiseError null
javascript v17 UncaughtPromiseError
Avatar
0
apr. 25
1558
Custom button trigger in FormController?
javascript action v17
Avatar
0
dec. 24
2401
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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