Problem in creating a hook

I have created hook in the following way…( For Sales Order)
I have created new python script “” in the "sales_order " doctype folder and i have created hook in “

Following is my code in ""

i am getting following error in calling my hook

Traceback (most recent call last):
File “/home/jithendra/frappe-bench/apps/frappe/frappe/”, line 56, in application
response = frappe.handler.handle()
File “/home/jithendra/frappe-bench/apps/frappe/frappe/”, line 19, in handle
File “/home/jithendra/frappe-bench/apps/frappe/frappe/”, line 42, in execute_cmd
ret =, **frappe.form_dict)
File “/home/jithendra/frappe-bench/apps/frappe/frappe/”, line 903, in call
return fn(*args, **newargs)
File “/home/jithendra/frappe-bench/apps/frappe/frappe/desk/form/”, line 19, in savedocs
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 735, in submit
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 724, in _submit
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 231, in save
return self._save(*args, **kwargs)
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 281, in _save
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 787, in run_post_save_methods
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 663, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/jithendra/frappe-bench/apps/frappe/frappe/model/”, line 881, in composer
File “/home/jithendra/frappe-bench/apps/frappe/frappe/”, line 883, in get_attr
return getattr(get_module(modulename), methodname)
AttributeError: ‘module’ object has no attribute ‘calculate_taxes’

What else i am missing out here.


calculate_taxes is a class method and can not be called without creating class object.
instead of class method define your method out side of class.


Thank You @makarand_b for the suggestion.
Issue has been Solved.