Topic: Clone a company minus the transactions?

I already have a company installed with 2 years worth of accounting entries. I need to set up a new company. The new company is a different entity.

However, in the first company I spent quite some time in setting up the correct accounting scheme and tax schemes.

I wished I could clone the first company minus the balance and transactions and articles. Keeping the vendors and suppliers would be nice but not that important.

Or is it simpler to start the company from scratch and enter the data (accounts and taxes) manually? Because after all that would be faster than breaking my head over exporting and importing tables?

jlinkels

Re: Clone a company minus the transactions?

I have been reasonably succesful with this.

First I had a look at the default Dutch CoA nl_NL-default.sql. It looked like all tables are defined in this SQL file, and into some tables data has been inserted. To be precise, 69 tables are defined, and into 39 of them data is inserted.

So I compared this with a backup of the existing company I wanted to clone. In this source file I compared every INSERT statement with the INSERT statement for the same table in the nl_NL-default.sql. When the INSERT statement was present in the nl_NL-default.sql, I maintained the statement from the backup. When in nl_NL-default.sql there was no data inserted into that table, I removed the INSERT statements from the backup file.

Then created the new company and noted the new table prefix. I replaced all prefixes in the table names with the proper prefixes for the new company in the backup file. And copied the backup file to account/company/3/backup. (3 is the number of the new company)

I logged in into the new company and restored the backup. So far everything seems to work all right.

jlinkels

3 (edited by apmuthu 08/21/2014 07:24:34 pm)

Re: Clone a company minus the transactions?

It is possible you may have missed out some data that may refer to the original company number in it's foreign keys....
Also any newly added accounts in the masters as well as users and their ACLs may be missing too besides exchange rates.

Export the account and inventory masters and import them into a newly created company and set the preferences but all this only after you have installed and activated existing non-default extensions if any.

Re: Clone a company minus the transactions?

Hi apmuthu,
Thanks for taking a look into this.

apmuthu wrote:

It is possible you may have missed out some data that may refer to the original company number in it's foreign keys....

I hope not. At various other instructions on this site about importing and exporting a company it is recommended to rename the company tables from X_* to Y_*. So I assumed it is safe.

apmuthu wrote:

Also any newly added accounts in the masters as well as users and their ACLs may be missing too besides exchange rates.

That is why I took the default CoA as an example. All tables which were not filled in the default CoA I did not fill in my clone. That means that all data in the default CoA tables may or may not refer to each other. But in no case anyhting in the populated tables can refer to something in the empty tables. So in my assumption: when I have a consistent database I can empty the same tables which are empty in the default CoA. Not so?

apmuthu wrote:

Export the account and inventory masters and import them into a newly created company and set the preferences but all this only after you have installed and activated existing non-default extensions if any.

What do you mean by "exporting"? Is that something to be done from within FA? If so, I overlooked that command.

jlinkels

5 (edited by apmuthu 08/30/2014 07:25:34 pm)

Re: Clone a company minus the transactions?

Import Inventory Items is an extension for FA. It can be installed and activated from within FA. The pertinent files are available for analysis / forking at my unofficial GitHub repo. The format of the import CSV would be the same as the export one and can be culled from the extension.