Modifying existing DocTypes

Hi.

I want to add a couple of extra fields to Supplier DocType…

However, if I update ERPNext using bench update, will my Supplier DocType get overwritten? Will it get overwritten on version upgrades? Is it better to create a new supplier docytype (such as Supplier2) and add the existing fields and then just use that form for new suppliers?

Thanks.

@abbas If you are self-hosted then:

The best way to add new fields and customizations is through “Customize Form”.
If you plan to update your production server then you can maintain those changes using fixtures.

Great thank you.

Currently, in test phase while I document everything. What do you mean by “fixtures”?

I assume on the next iterations ERPNext, I can simply “Bench Update” and everything should come across? including these custom fields? I don’t intent to touch any lines of code.

I was also under the impression my backup (via ERPNext/Cronjob) contains all these extra fields (I will test this)??

Thanks.

Check this: Schema modification export (custom fields)

@abbas Great question!
I’m going to “call a friend”, and tag @tmatteson @MichaelPinkowski and @nabinhait to this discussion.

Guys: you know this is one of my big hang-ups.

Has anything changed in the past year, in terms of supporting changes to DocTypes that are part of the main repository?

Any new methods to manage/merge DocType conflicts during updates (besides doing your own thing with git diff, SQL table compare, branches, etc?)

Or…does the community officially recommend that @abbas:

  • Create a “Supplier2” doctype, with a 1:1 relationship to Supplier doctype.
  • Add the columns he needs to Supplier2
  • Edit his form, so that data from both DocType is displayed on the screen simultaneously.

Thank you for the replies guys.

@brian_pond you missed adding “custom fields” @rodrigo.giacobelli mentioned. I have added a couple of fields in Supplier and the import template sees theses fields so its a big win!

I don’t require anything special with Supplier, just a couple of extra fields so I am not sure if Supplier2 is the way forward really? Does that not duplicate data?

I require extra fields in other areas (BOM, Customer etc) and custom fields will do the trick.

Thank you @rodrigo.giacobelli for the Schema export. Will be very useful looking at the backup/failover option. Currently I am thinking MariaDB sync (semisynchronous-replication)

Thank you guys, appreciate it.

Hi.

Continuing my testing, I have setup several custom fields in the core doctype and the forum suggests having a sepearte app to store these fields.

I have found New app on frappe which shows how to create a new app.

However, I have a couple of questions:

  1. How do I then push that to my private GIT respositry so I can develope in my desktop IDE
  2. When I update code (i.e. add new fields), will “bench update” also update this app or do I need to do a git pull ?
  3. Has anyone got an example of custom fields app I could take a look at?

Thank you!