I want to change a function in js
file. How to do it? Is there any ways to override the function?
addons/web/static/src/js/views/form_common.js
,
i want to change the function-get_search_result: function(search_val){}
dataset.name_search(search_val, self.build_domain(), 'ilike', 160).done(function(_data) {self._search_create_popup("search", _data);}
need to change the value 160
to something else
Thanks in advance
There is a good answer/example on this question, which gives a pretty good overview. That example is actually a bit more in depth than necessary for a global JavaScript change.
If you identify the function you want to override, then it's mostly just a matter of mirroring core and making the override(s) you want. Here's an example overview of how to change the
name_search
JavaScript behavior:your_module/manifest.py
your_module/views/assets.xml
your_module/static/src/js/custom.js
You can do it like they did in
google_calendar
: