Skip to Content
Menu
This question has been flagged
1 Reply
2618 Views


I have the following problem.


when I use the define , I have the error " core not defined"  and all the dependencies too.

I add [] because , i have error " Dependencies should be defined by an array: function(require)"


Example: 

odoo.define('pos_button.Custom', [], function (require) {
"use strict";
var core = require('web.Core');


i try 
 odoo.define('pos_button.Custom',[], function(require) {

    'use strict';

      const { Gui } = require('point_of_sale.Gui');

      const PosComponent = require('point_of_sale.PosComponent');

      const { identifyError } = require('point_of_sale.utils');

      const ProductScreen = require('point_of_sale.ProductScreen');

      const { useListener } = require("@web/core/utils/hooks");

      const Registries = require('point_of_sale.Registries');

      const PaymentScreen = require('point_of_sale.PaymentScreen');

      console.log("Custom JavaScript In POS")


but i have error "TypeError: require(...) is undefined"


What am I doing wrong?


Thanks for help.




Avatar
Discard
Best Answer

Hi,

In odoo 17, the Owl method is used for JS. In your current code, you are using the backbone method.So you need to migrate your code to OWL for the correct working.
You can refer to the blog below to get an idea of OWL

https://www.cybrosys.com/blog/how-to-create-custom-number-popup-in-odoo-17-pos-using-owl

Hope it helps

Avatar
Discard
Related Posts Replies Views Activity
4
May 25
1238
2
May 25
4383
1
Mar 25
735
4
Mar 25
3437
3
Feb 25
4138