How to Export database per company

Hi all,

Anyone knows or already did an export of a database per company?

Let’s say I have a customer with 3 companies inside and they only need to export all data related to company number TWO so later can be imported to a single site…


That’s an interesting question.

Unlike some other software, ERPNext does not separate -all- records by Company. Only some records. For example:

  • Sales Orders: There is a DocField named “company”
  • Customers: There is a DocField named “represents_company”
  • Items: No field for storing Company.
  • BOM: There is a DocField named “company”
  • Contact: No field for storing Company.

So some tables are considered “global” for all companies.

I guess you could backup the database. Restore to the new Site. And then write scripts to delete the extra records. But the scripts would need to be smart. And walk through all the DocFields, looking for anything that is a Link to Company.

Tricky. But seems like something worth having in ERPNext someday.

For sure is interesting…

I have done this two/four months ago for a customer…
We have a DB with 8 Companies inside and only needed to transform one of the companies as a standalone site so we did a copy of the DB created the new company and restored all records.

But was lot of work because, there are records where Company field is not present and the information is connected to the main company… Besides all the work the company moved was only in need of Sales Invoices and JVs for which the Company field is present.

For sure this should be something to be added on ERPNext core.