콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
3220 화면

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

아바타
취소
베스트 답변

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

아바타
취소
베스트 답변

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

아바타
취소

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

작성자

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

관련 게시물 답글 화면 활동
1
8월 22
48
1
3월 25
3769
0
2월 23
1972
0
6월 22
2276
3
2월 25
12673