Comparison of original doctypes with customized doctypes

Hi folks,

I have been customizing the doctypes using customize form. (erpnext v12)
After many customizations, i am unable to track what docfields i have added and removed.
Is there any trick/hack to compare two doctypes. Row by row checking is difficult since there are more than 100 docfields in some doctypes.

Temporary Workaround: A simple solution is that at the end customized doctype, we will be able to see some helpful text messages that *You have added "discount_extra" field*. But they become invisible when i get apps onto another site.

Final Query: Is there any way to compare two doctype just like we have diffchecker (copyrights & registered trademark of respective company) site for checking code differences.

Any help is highly appreciable!!!

“After many customizations, i am unable to track what docfields i have added and removed.”

I suggest investigate this

bench export-fixtures

Reference this Adding fields to Doctype

To confirm your results and findings you could run SQL queries on tabCustom Field

edit: Try a query like this select name,fieldname,dt from `tabCustom Field`;

Here’s an example session:

frappe@ubuntu:~/frappe-bench$ bench mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 394
Server version: 10.2.13-MariaDB-10.2.13+maria~xenial-log mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [1bd3e0294da19198]> select name,fieldname,dt from `tabCustom Field`;
+----------------------------------------------------------------------+------------------------------+-----------------------------------------+
| name                                                                 | fieldname                    | dt                                      |
+----------------------------------------------------------------------+------------------------------+-----------------------------------------+
| Address-gst_state                                                    | gst_state                    | Address                                 |
| Address-gst_state_number                                             | gst_state_number             | Address                                 |
| Address-gstin                                                        | gstin                        | Address                                 |
| Address-woocommerce_check                                            | woocommerce_check            | Address                                 |
| Address-woocommerce_email                                            | woocommerce_email            | Address                                 |
| Address-woocommerce_id                                               | woocommerce_id               | Address                                 |
| Company-arrear_component                                             | arrear_component             | Company                                 |
| Company-basic_component                                              | basic_component              | Company                                 |
| Company-hra_component                                                | hra_component                | Company                                 |
| Company-hra_section                                                  | hra_section                  | Company                                 |
| Company-hub_sync_id                                                  | hub_sync_id                  | Company                                 |
| Customer-woocommerce_check                                           | woocommerce_check            | Customer                                |
| Customer-woocommerce_email                                           | woocommerce_email            | Customer                                |
| Customer-woocommerce_id                                              | woocommerce_id               | Customer                                |
| Deleted Document-gcalendar_sync_id                                   | gcalendar_sync_id            | Deleted Document                        |
3 Likes

Whoa, I learn something new every day, just by visiting the forum :slight_smile:

1 Like

I am getting error when i did

bench --site sitename export-fixtures

or

bench export-fixtures

Hope that this below console error message might provide some useful info.

user001@lenovo-erp-002:~/site_sites$ bench export-fixtures
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/user001/site_sites/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/user001/site_sites/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/user001/site_sites/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/user001/site_sites/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/user001/site_sites/apps/frappe/frappe/commands/utils.py”, line 216, in export_fixtures
frappe.init(site=site)
File “/home/user001/site_sites/apps/frappe/frappe/init.py”, line 174, in init
setup_module_map()
File “/home/user001/site_sites/apps/frappe/frappe/init.py”, line 980, in setup_module_map
for module in get_module_list(app):
File “/home/user001/site_sites/apps/frappe/frappe/init.py”, line 850, in get_module_list
return get_file_items(os.path.join(os.path.dirname(get_module(app_name).file), “modules.txt”))
AttributeError: module ‘site_sites_core’ has no attribute ‘file

Your directory structure is odd - bench commands are normally run from the bench directory (for example frappe-bench), with sites/ a subdirectory below the bench, for example:

 frappe@ubuntu1804lts:~/frappe-bench$ ls -al
total 48
drwxrwxr-x  8 frappe frappe 4096 Dec 31 23:57 .
drwxr-xr-x 14 frappe frappe 4096 Dec 31 23:50 ..
drwxrwxr-x  5 frappe frappe 4096 Dec 17 02:35 apps
drwxrwxr-x  4 frappe frappe 4096 Mar 18  2019 archived_sites
drwxrwxr-x  3 frappe frappe 4096 May 21  2019 config
drwxrwxr-x  8 frappe frappe 4096 Mar 18  2019 env
drwxrwxr-x  2 frappe frappe 4096 Dec 31 21:47 logs
-rw-rw-r--  1 frappe frappe  194 Dec 17 05:01 patches.txt
-rw-rw-r--  1 frappe frappe  429 Dec 31 23:57 Procfile
drwxrwxr-x  4 frappe frappe 4096 May 21  2019 sites
frappe@ubuntu1804lts:~/frappe-bench$ bench version
erpnext 11.1.30
frappe 11.1.62