Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
3467 Visninger

I want to change web.searchutils const variables such as FIELD_OPERATORS and ... .

I know the way to override a js method but couldn't figure out how to override a variable. replacing the js file completely will also solve my problem but I wasn't able to figure out how. thanks in advance.

the mentioned file is: /addons/web/static/src/legacy/js/control_panel/search_utils.js

Avatar
Kassér
Bedste svar

Hi,

Try like below code

odoo.define('my_module.searchUtils', function (require) {
"use strict";

var searchUtils = require('web.searchUtils')

searchUtils.FIELD_OPERATORS = // What you want

});

Regards

Avatar
Kassér
Bedste svar

Unfortunately, there is no easy way to override const variable :(  
Once I was stuck with the same kind of issue, I wanted to add a new date range period so it required overriding YEAR_OPTIONS workaround would override the function which utilizes this const variable

Avatar
Kassér

if you found any easy way let me know I am curious about it :)

Forfatter

@Ravi Gadhia I wrote the file completely again and replaced it using (
'remove', 'file_path) in the manifest file.

Related Posts Besvarelser Visninger Aktivitet
1
aug. 22
48
1
mar. 25
4138
0
feb. 23
2265
0
jun. 22
2613
3
feb. 25
14212