Custom app -python file

i have created a custom fields in project doctype.
Succefully added fixtures in my custom app
Now i m writting the py file to validate this custom field .

image

hooks.py file is here:

image

still i m not able to get expected output.

image

Is my syntax in py and hooks file is right?
can someone help me on dis?

Add print statement or simple frappe.msgprint() in your method to get to know whether your function is callable or not.

One more thing, remove line - doc.save() as your calling your method on validate.

i have tried below line in abcd function

def abcd(doc,method):
doc.stock_entry_consumable=doc.total_sales_amount*10;
frappe.msgprint(doc.total_sales_amount);
console.log(doc.total_sales_amount)

did bench restart.

still not getting expected output.

Seems like your path is incorrect then.
run bench console from frappe-bench dir. and try to import your method.

e.g.

But if your path is incorrect it will give you error

i have tried.it is accepting.

image

what is the error sir?
I m not able to get expected output.
plz help

try your method,

from overtime.overtime.project_custom import abcd

i have try dis sir,

it is accepting my line.

image

Okay.

So, you are updating stock_entry_consumable field form project on save.

try following,

def abcd(doc, method):
	frappe.msgprint("Project validation..")
	doc.stock_entry_consumable = 100

and save any project record, you will see this message pop-up. Also, make sure your filed-name is correct.