How To Call An Odoo Controller Function From Js File
i set a keyDown from JS file call a function in Py file this is my JS file _onKeydown_searchText: function () { var self = this; var search = {}; search.Input = self.$(
Solution 1:
lĂȘ chang
You can send the value from JSON-RPC into your Json controller
Js File:
var ajax = require('web.ajax');
ajax.jsonRpc("/custom/url", 'call', {'Your Key': YourValue}).then(function(data) {
if (data) {
// Code
} else {
// Code
}});
Py File: Get the data from the post like this.
@http.route(['/custom/url'], type='json', auth="public", website=True)defcustom_cotroller(self, **post):
get_data = post.get('Your Key')
# Your Customise Code
Post a Comment for "How To Call An Odoo Controller Function From Js File"