When we should write a patch?

Hi @asharamseervi,

Patches are used for example when you make a change in an existing functionality and want to update instances that are already running ERPNext to make it compatible with that change. Or it can also be used when you need to correct something in a functionality already used in production.

Patches are only meant to be run once on each sites already running ERPNext. They are never run twice and never run in a new site.

For example, one of the latest patch is meant to rename School into Education.
On a new site, the Doctype Education exists from the beginning so you don’t need to do anything, but on an older site, the doctype was named School, so you need to update the database to have it named Education to be compatible with the new code base in ERPNext. Therefore you run a script that renames School to Education when you update your codebase with Education everywhere instead of School.

Hope it’s clear :slight_smile:

6 Likes