Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2699 Widoki


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.




Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
maj 25
1332
2
maj 25
4663
1
mar 25
814
4
mar 25
3514
3
lut 25
4263