In one of our ERPNext sites, a couple of standard fields are missing from the Employee doctype. We’ve tried running:
bench --force --site MySite reload-doc setup doctype employee
The fields are however still missing. Any advice on how this can be resolved will be greatly appreciated
@wale are you sure the data is missing for your current version ? what version you using ? and what fields are missing ?
did you change anything in the core code ?
Thanks for your response. Yes, I’m quite sure the fields are missing. Not sure what happened exactly but it must have been in the process of migration to V14
The site is on V14 latest… I’ve run
bench update several times as you can imagine
Any ideas ?
@wale try to do bench migrate if you just migrated . if you have no changes in the core you can do bench update --reset . this will redownload and reinstall all tables/files.
bench update --reset
I’ve tried this multiple times… still no change !
The deletion of the two fields might not be a bug and instead could be a feature…
If you need them, just add some custom fields.
Thanks for your response. I doubt this because other V14 instances I checked have those fields
This would have worked previously but now, the system automatically appends ‘custom_’ to the name of every custom field. I need the ‘job_applicant’ field particularly because some queries like
frappe.db.exists return an error when a link field (like job_applicant) is missing
Still hoping for suggestions on solving this issue…
Is there any version of this command that works for V14 ? We really need to resolve this as we currently can’t save any changes to the Employee form
So, on examining the hrms code, I realised that the field in question (along with a number of other fields) are supposed to be created by the hrms app upon install. This somehow failed so the question now is this… How do I re-trigger it without losing any data ?
You could try bench --site uninstall-app hrms
Then bench --site install-app hrms
Uninstalling the app should not delete any files in the database.
The uninstall-app command shows the following warning:
All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue?
Any thoughts on this ?
I just confirmed that using the uninstall command will actually drop tables from the db !
What now ?
You could take a backup of your database using the
bench backup --with-files
Then reinstall the app in the site, then use
bench restore (sql-path) --private-file (private-file-path) --public-file (public-file-path)
This would ensure your data is not deleted.
Thanks for your suggestion but that’s exactly what I did to check the impact of the command. The restore operation naturally takes the installation back to how it was before the uninstall…
Any other ideas ?