[Question] Steps to do PR that involves changes to existing doctype

Hi,

I am working on bug fixing/enhancement on develop branch. I would like to do a pull request.

Beside .py , my work includes changes to existing doctype. Ex. I have added a new check box field to customer doctype.
When i do a $ git status. It shows changes done on .py but doesn’t reflect changes done on existing doctype.
My understanding is when i add new field to existing doctype ex customer. It is a db level change, so how to do propagate this changes to my fork and ultimately a pull request.

Note, developer_mode is enabled.
Please guide. thanks

Save your doctype again. If developer_mode is on, it will update the JSONs

This is strange

When i create new doctype, git status shows the changes

But for existing doctype when new field is added. git status shows no change. Also i checked customer.json the new field is not there. If i check on mysql desc tabCustomer new field is there. When i create a new customer the new field is there
Note sure, what could be wrong?!

Hi @ashish-greycube

Thanks for contributing! I had the same experience… eventually had to edit the .json files directly which is more cumbersome. Hopefully it gets fixed soon but in the meantime you could consider editing the .json file

Cheers!

Oh… and don’t forget to update the value for "modified": in the json file and do a bench migrate when you’re done editing

Kind regards,

Make sure you do a bench --site sitename clear-cache after changing your site config

1 Like

Did clear cache, still json is not updated.
I guess the only option left is to manually edit json

Don’t mind, let me ask the basic. Are you adding the new field from Customize Form? In that case it will not affect json file. You need to add the field directly in the doctype.

Hi nabin,
I guess you nailed it. Yes i am adding new field to customize form ( in effect adding a field to tabCustomer).
So i guess in spite of developer_mode set, it would not update json.
Solution : You have set developer_mode : 1. You are adding a new field to existing doctype via customize form. You expect doctype json to have the new the field added. But it will not. So workaround is to update json manually.

No, if you are using Admin login, then add the field directly in DocType, it will update json.

Hi Nabin
Happy Diwali and New year!!
json doesn’t get updated. all recommended steps are done
1)set developer_mode : 1
2)bench --site sitename clear-cache
3)Did customize form with admin login

@ashish-greycube dont add field in customize form do it directly in doctype

ERPNext -> Developer -> Doctype

@hereabdulla, I am NOT creating a new doctype. I am modifying existing doctype i.e. I wish to add new field to customer doctype

That too you need to add in doctype then only it will reflect in json

It is finally working for me. Final steps
Task : Want to add new field to existing doctype. Ex want to add a check box in customer doctype
Solution :
1)set developer_mode : 1
2)bench --site sitename clear-cache
3)Use admin login
4) Go to Explore–>Developer–>Doctype–>Click on doctype you want to modify(ex customer)
5)Once the doctype opens, click Add row and add new field. Save it
6) Do git status. It shows json is modified
modified: erpnext/selling/doctype/customer/customer.json
Thanks nabin / abdulla and rushab for all the help
@wale above steps should help you.

1 Like

Hi @ashish-greycube

Thanks for bringing this to my attention

@nabinhait thanks a lot for the guidance and clarification

Cheers!