Whitelist Function error

Im learning how to create custom apps, and I needed to set a value from the app setup DocType, so I create a Whitelist method to use frm.set_value() later, and I type this command:

bench execute dealer.dealer.doctype.venta_de_auto.venta_de_auto.prueba

and its ok, but when I
go to the docType throws me an error:


this is the test whitelist function:

from __future__ import unicode_literals
import frappe

def prueba():
	frappe.msgprint("Prueba desde Funcion whitelist en venta_de_auto.py")
	print("Prueba desde Funcion whitelist en venta_de_auto.py")
	return True

and this is the call in the js file:

frappe.ui.form.on('Venta de Auto', {
	onload: function(frm) {
	 	frm.set_query("vehiculo", function() {
			return {
				"filters": {
					"item_group": "Vehiculo",
	type: "GET",
	method: "dealer.dealer.doctype.venta_de_auto.venta_de_auto.prueba",
		callback: function(r) {

what Im doing wrong?

thanks in advance.

this error means that the frappe call cannot fing the prieba function,

where is the py file located? whats its name? app name?

did you bench migrate your site? and clear cache , restart the bench?

I wrote the whitelist function in the controller’s DocType
The .py file is venta_de_auto.py
The app name is dealer

I just did, but nothing happened,

I did it also, nothing happened,

It was the problem

Thak you so much man,

I have a development enviroment, and I though that we didn’t need to restart bench on develop, I Stopped with ctrl+c and then start bench again with
bench start

So I’m assuming you didn’t have to put it in the hooks.py on your app.

Well, Im too newby on this, I am just following the tutorials, and studying some core code, I don’t think that im in that level yet.

I’ve been watching that the bench (developer) sometimes when I make a change it recognizes it. but sometimes it doesn’t, and I have to restart Bench.

I honestly started about 2 months ago… I’m currently working on multiple projects … I also recently picked up python because of this application so I’m learning as I go…

1 Like