Skip to Content
Menu
This question has been flagged
4 Replies
1240 Views
KeyNotFoundError: Cannot find owl.action_bag_owl in this registry!
    Error: Cannot find owl.action_bag_owl in this registry!

this error is came when i try to overide owl component

/* @odoo-module */
import { registry } from "@addons/web/core/registry";
//const {Component, useState} = owl;
import { Component, useState } from "@addons/odoo/owl";

export class OwlBagList extends Component {
setup() { this.state=useState({value:1})}
}
OwlBagList.template = 'owl.BagList'
registry.category("actions").add("owl.action_bag_owl", OwlBagList);
record id="action_bag_owl_id" model="ir.actions.client"
field name="name">Bags List owl field
field name="tag">owl.action_bag_owl field
record

now in view i am using same tag as owl.action_bag_owl and in js file also i am using same  owl.action_bag_owl so why i am getting that error

Avatar
Discard
Author

anyone solve error

Best Answer

Ensure JavaScript File Loading: Make sure your JavaScript file is being correctly included in web.assets_backend. You need to add the script reference in your XML file as follows:


   
       
           
       
   

Check Template Definition: Verify that the template owl.BagList is defined correctly in your XML file:


   

       

Your Owl Component


       
   

Correct Imports: Double-check the import paths in your JS file:

import { registry } from "@web/core/registry";
import { Component, useState } from "owl";

Ensure these paths match the Odoo module paths for Odoo 17.


Ensure Correct XML Record Structure: Make sure the ir.actions.client record is properly defined in your XML file:


    Bags List Owl
    owl.action_bag_owl

Restart Odoo and Clear Cache: After making changes, always restart your Odoo server and clear your browser cache to ensure all assets are reloaded.

Avatar
Discard
Author Best Answer

Hi,

Thanks cybrosys for replying. i have checked __manifest__.py file where i have added 

'assets': {
'web.assets_backened': [
'my_bags/static/src/components/bag_list/OwlBagList.js',
'my_bags/static/src/components/bag_list/bag_list.xml',
],
},

and also i have  update the import statements for the registry and OWL  components in js file

import { Component, useState } from "@odoo/owl";
import { registry } from "@web/core/registry";

but still i am getting this error

KeyNotFoundError: Cannot find owl.action_bag_owl in this registry!
    Error: Cannot find owl.action_bag_owl in this registry!

can you resolve it

Avatar
Discard
Best Answer

Hi,


Please check your __manifest__.py file to ensure that your JS file is properly included in the assets bundle of your module:


'assets': {

    'web.assets_backend': [

        '/path/to/your/js',

    ],

}


Make sure the path to your JS file is correct. Also, update the import statements for the registry and OWL components:


import { registry } from "@web/core/registry";

import { Component, useState } from "@odoo/owl";


Hope it helps

Avatar
Discard
Best Answer

change the import statements like

import { registry } from "@web/core/registry";
import { Component, useState } from "@odoo/owl";



Avatar
Discard