Extend or override doctype json through custom app

Is it possible to extend or override a built in doctype json throu a custom app?

Yes, very much.

Is the json file to be included in the hooks.py or in the js?
Whats the way to do it?

Through both depending on your case, could you specify your requirement?

I’m looking for solution for this topic, because I want to override doctype json file to add some extra info.

@Shinzuco can you provide us both solution or point us to the related documentation, thanks

create a custom app
use customize doctype option,
Add the file to hooks.py (of the custom app) like so

fixtures = [
{
    "dt": "Custom Field",
    "filters": [
        [
            "dt",
            "in",
            ("DOCTYPENAME"),],],
  		},]

Run the command bench export-fixtures
install the custom app wherever you need the changes to apply

Can I replace fields? in case I want to rename a field or delete it?

To rename a field, customtomize the doctype and change the label,
Instead of deleting the field, you may make it hidden/readonly.

After both cases, run the below code (instead of Custom Field, use Property Setter.)

fixtures = [
{
    "dt": "Property Setter",
    "filters": [
        [
            "dt",
            "in",
            ("DOCTYPENAME"),],],
  		},]

Thanks @Shinzuco my problem with renaming the fields is that I;m integrating with an external system which uses camel case syntax.

So this system is looking for currencyType but I’m storing currencytype.

For anyone else having this issue, I am solving it by creating an API method for translating the field names and I;m letting frappe autoname them when creating doctypes.

1 Like