Thanks a lot Ankush.
So I started to do so:
For a doctype ‘tiers’ I updates the corresponding tiers.js file:
frappe.ui.form.on("Tiers", "onload", function(frm) {
frm.set_query("adresse", function() {
return {
query: "asso.queries.autocomplete_adresse"
};
});
});
I also created the corresponding python file with the following code:
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def autocomplete_adresse(doctype, txt, searchfield, start, page_len, filters):
return (
{
'a' : 'pomme',
'b' : 'poire',
'c' : 'orange'
}
)
At then end I get the following error message:
Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 56, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 53, in handle
return _RESTAPIHandler(call, doctype, name).get_response()
File “apps/frappe/frappe/api.py”, line 69, in get_response
return self.handle_method()
File “apps/frappe/frappe/api.py”, line 79, in handle_method
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 48, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1596, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/typing_validations.py”, line 33, in wrapper
return func(*args, **kwargs)
File “apps/frappe/frappe/desk/search.py”, line 292, in wrapper
sanitize_searchfield(kwargs[“searchfield”])
KeyError: ‘searchfield’
Well, I am not an IT guy and I have a very poor knowledge of Python. Right now, that is out of my competencies.