Is it possible to integrate erpnext to another custom app which are exist in different sites

Hi,
I installed ERPNext inside a site “tech.local”, and i installed my custom app inside a site repos.local where erpnext is not installed. can i use any doctypes are any other functionality of erpnext to my custom app which is exist in another site.

Hi,

To access ERPNext functionalities within your custom app, you’ll need to have ERPNext installed on the same site.

Example: Imagine you have a custom app for inventory management. If you want to use ERPNext’s purchase order module within your app to create and track purchase orders, you must have ERPNext installed on the same website or server as your custom app.

In a multi-tenant environment, where multiple websites or applications share the same server, you cannot directly access resources from one site within another. This is to ensure data security and isolation between different tenants.

Thanks,

Divyesh Mangroliya

Okay thankyou, can you also tell me how to handle this process, i mean everyone says that using hooks.py we can access the erpnext functionality to our custom app.

Regarding this:

If i want to use purchase order and also i want to modify its code functionality means. i can’t do this inside erpnext so only i should use it in custom app right?
So, now my doubt is how to use doctypes or modules like purchase order from erpnext to custom app and where can i modify its, code functionality. this is the only thing i want to know, so explain me this please.

Hi,

Modifying standard ERPNext code directly can lead to issues during upgrades. To customize existing functionalities, leverage the power of overrides!

Here’s how to override standard DocTypes in your custom app:

  1. Create a Custom App:
  • Use the command bench new-app your_custom_app_name to create a new app.
  • Install the app with bench --site your_site_name install-app your_custom_app_name.
  1. Define the Override in Hooks:
  • Navigate to your_custom_app_name/hooks.py within your app directory.
  • Add the following code snippet to override the desired DocType:`Pythonfrom erpnext.utils import override_doctype_class

override_doctype_class[“ToDo”] = “your_custom_app_name.overrides.todo.CustomToDo”`

Use code with caution.

  1. Create the Custom Class:
  • Create a new Python file within your app, like your_custom_app_name/overrides/todo.py.
  • Define your custom class extending the standard DocType:`Pythonfrom erpnext.tasks.doctype.todo.todo import ToDo

class CustomToDo(ToDo):
# Implement your custom logic and overrides here`

  1. Restart Bench:
  • Apply the changes by restarting Bench with bench restart.

This approach allows you to safely modify standard DocTypes while keeping your customizations separate. Remember to replace your_custom_app_name with your actual app name and ToDo with the DocType you want to override.

Thankyou for your help. now i understood.