CustomDoc JSON files reverted to old state during 'bench update'

Hello, I just performed a bench update in hopes it would rebuild the python files. From the very little information I can find this seemed the way.

After the update completed I have lost many days of work on CutomDocs I have made. The database is correct but the .json files where somehow reverted back to a very old state.

I have three custom doctypes that have been changed.

Is there anyway I can recover this. It would save me a bunch of time.

Thank you…

To add some detail to this.

This is what I get when I run git status.

On branch master
Your branch is up-to-date with 'upstream/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        erpnext/accounts/print_format/non_disclosureagreement/
        erpnext/accounts/print_format/testing/
        erpnext/hr/doctype/non_disclosure_agreement/
        erpnext/stock/doctype/attach_document/
        erpnext/stock/doctype/document/

nothing added to commit but untracked files present (use "git add" to track)

This is what I get when I run git reflog.

108bc78 HEAD@{0}: pull: Fast-forward
6cb8662 HEAD@{1}: reset: moving to HEAD@{8}
9e19251 HEAD@{2}: revert: Revert "Merge branch 'develop'"
108bc78 HEAD@{3}: pull: Fast-forward
6cb8662 HEAD@{4}: reset: moving to HEAD@{5}
574415b HEAD@{5}: reset: moving to HEAD@{1}
6cb8662 HEAD@{6}: reset: moving to ORIG_HEAD
574415b HEAD@{7}: reset: moving to HEAD^
6cb8662 HEAD@{8}: reset: moving to HEAD@{1}
108bc78 HEAD@{9}: pull upstream master: Fast-forward
6cb8662 HEAD@{10}: clone: from https://github.com/frappe/erpnext

Some of the HEAD are me trying to revert back to what was lost.

Does the ‘bench update’ command perform a commit or merge before the pull?

Thanks again for any assistance.

Is non_disclosure_agreement your customize doctype?

Yes, all the files listed there are my custom ones. two of them where mistakes.

The one I am most concerned about is erpnext/stock/doctype/document

Thanks,

Your customize doctype should not belong to erpnext app. You have to create a new app for your customization see https://frappe.github.io/frappe/user/tutorial/ so that everytime the core developers has new update your Customization will not be affected

So, creating a new custom doctype in setup is not the way to add something to the Stock category? I am surprised that you can create a new doctype and it will be wiped out if there is an update.

I am confused as to why the files related to my custom doctypes where even changed if they where not apart of GIT.

The whole thing is very confusing to learn.

ccfiel, thank you very much…

@zeroxcorbin the update dropped your customizations because you have created the doctypes with the instance in “developer mode”, while in developer mode, do you need keep it in a custom app.

@max_morais_dmm Thank you, so if I just turned off developer mode. If I create another doctype will it be “protected” during an update?

@ccfiel When I install my custom app in my site will it show up on the erpnext desk?

Thank you,

@zeroxcorbin, all doctypes created in a not developer mode instance are managed as “Custom”, so I dont have files on disk

Yes it will.

@ccfiel Created and installed my new app and now receiving “Internal Server Error”.

Cleared all caches. Still nothing.

What is the error in your bench start?

@ccfiel Using Nginx. Checking now.

Please create new topic so that it easy for others to find issue

Full reboot of the system and no more errors. I removed the question and will repost-it.

Thank again for you help.

1 Like