My basic requirement is to do customizations on the existing ERPNext and move them over to the AWS. I understand that I should create a custom app and also create an api.py file over there, which will override the existing methods. What I am confused about is the exact procedure. These are the steps that I followed.
I created the git repository.
Then, I created a custom app where I could maintain all
the changes that I was going to make to the ERPNExt code. So, for
example, I wanted the excise amount to be displayed in words, I followed
these following methods:
bench new-app custom.
bench install-app custom
After this, I opened the hooks.py file inside the custom app and added
the code for calling the method from api.py file. This again I created
inside the custom app. I am not sure whether I have to make changes to
the hooks.py file inside the custom app or to the hooks.py file inside the erpnext app. Can you please help me here?
I might sound like a complete novice but these are some things which are actually giving me issues. Is there any step by step documentation for people like me who
have to do a lot of customizations on client’s sides.
After creating the custom app, when I am trying to open the customize form or custom field on my ERPNext, I am getting this error:
Traceback (most recent call last):
File “/home/umag/frappe-bench/apps/frappe/frappe/app.py”, line 55, in application
response = frappe.handler.handle()
File “/home/umag/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/umag/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/umag/frappe-bench/apps/frappe/frappe/init.py”, line 876, in call
return fn(*args, **newargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 68, in getdoctype
docs = get_meta_bundle(doctype)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 79, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 20, in get_meta
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 149, in hget
value = generator()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 20, in
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 32, in init
self.load_assets()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 39, in load_assets
self.add_code()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 77, in add_code
self.add_html_templates(path)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 88, in add_html_templates
for fname in os.listdir(path):
OSError: [Errno 2] No such file or directory: ‘/home/umag/frappe-bench/apps/custom/custom/custom/doctype/custom_field’
Thanks Nabin and Rushab,. I am getting this following error while I am
trying to open customize form or custom filed inside ERPNEXT.
Traceback (most recent call last):
File “/home/umag/frappe-bench/apps/frappe/frappe/app.py”, line 55, in
application
response = frappe.handler.handle()
File “/home/umag/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in
handle
execute_cmd(cmd)
File “/home/umag/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in
execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/umag/frappe-bench/apps/frappe/frappe/init.py”, line 876, in
call
return fn(*args, **newargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line
68, in getdoctype
docs = get_meta_bundle(doctype)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line
79, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
20, in get_meta
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”,
line 149, in hget
value = generator()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
20, in
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
32, in init
self.load_assets()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
39, in load_assets
self.add_code()
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
77, in add_code
self.add_html_templates(path)
File “/home/umag/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line
88, in add_html_templates
for fname in os.listdir(path):
OSError: [Errno 2] No such file or directory:
‘/home/umag/frappe-bench/apps/custom/custom/custom/doctype/custom_field’
As I was facing issues yesterday, I reinstalled ERPNext and again created the custom app. So, there is nothing that I have added on the hooks.py file so far.
I have tried to create the following code in the hooks.py file
doc_events = {
“Sales Invoice”: {
“on_update”: “custom.custom.api.set_total_in_words”
}
}
And, in my api.py file, which is present inside frappe-bench/apps/custom/custom/custom, i have added this following code:
@frappe.whitelist()
def set_total_in_words(doc, method):
print(“am i inside”)
from frappe.utils import money_in_words
company_currency = get_company_currency(doc.company)
disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total"))
if doc.meta.get_field("base_in_words"):
doc.base_in_words = money_in_words(disable_rounded_total and
abs(doc.base_grand_total) or abs(doc.base_rounded_total), company_currency)
if doc.meta.get_field("in_words"):
doc.in_words = money_in_words(disable_rounded_total and
abs(doc.grand_total) or abs(doc.rounded_total), doc.currency)
if doc.meta.get_field("amount_of_duty_in_words"):
doc.amount_of_duty_in_words = money_in_words(disable_rounded_total and
abs(doc.excise_amount) or abs(doc.excise_amount), doc.currency)
My code is not getting executed. Is there anything that I am doing wrong here?
Hi @rmehta hope you are doing good. I am new to ERPNext and frappe. I have experience in python, ODOO and django.
I am trying to build a connector between erpnext and quickbooks that will sync customers between them. I could not find appropriate way to start. Can you please guid me how can I achieve that.
Thanks @revant_one. it is build using OAuth1 quickbooks is using OAuth2 since July, 2017. Is there any latest version of this connector or I will have to do changes
Hi @nauman_sharif, did you face any challenge connecting ERPNext to QuickBooks?
QuickBook has support for oAuth 2 now but support for version 1 is not yet deprecated and connector works well.
We are upgrading the app for ERPNext version 10 and will release updates once testing is complete.