ERPNext customization not reflecting

hi all,

I have pushed all my erpnext changes to gitlab. But when i pull it to our server, which is in production mode, the changes are not reflected. ie, it doesn’t show my changes in the custom form. But when I inspect the file, (JSON file), everything is same as in the local machine.

In effect, the code in local machine works fine, but other is not.
Why it may be?
How can i make changes in the server too…

2 Likes

@Amalendu
Export changes using bench export-fixtures
take pull of your app on production
run bench migrate to apply fixtures

Regards,
Sambhaji Kolate,
New Indictrans Technologies Pvt Ltd.

@kolate_sambhaji
Thanks for the reply,
Before doing so, Can you advise me, whether I have to add fixtures in ‘hooks.py.’ (though I don’t know about it).

add fixtures in hooks.py of your app.
fixtures = [“Custom Script”,“Property Setter”, “Custom Fields”]

Regards,
Sambhaji Kolate,
New Indictrans Technologies Pvt Ltd.

Hello @kolate_sambhaji

When I do,
export-fixtures
It shows
Exporting Web Form app erpnext filters None
Exporting Custom Script app erpnext filters None
Exporting Property Setter app erpnext filters None

The issue is, in my ‘Project’ doctype, i added a child table with some fields. Then I did push to gitlab.
Later, I changed the design (some re-arrangement) and added some more custom fields to that child table.
Again i did a push, but when I did a pull to the production, it shows the child table with previous design. No added fields are there!!

Any help plz…

Add “Custom Field” in fixtures.
Also when you pull on production, run bench migrate

Hi @kolate_sambhaji

When I add “Custom Field” in Fixtures it shows the following Error!

 Exporting Custom Script app erpnext filters None
Exporting Property Setter app erpnext filters None
Exporting Custom Fields app erpnext filters None
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/commands/__init__.py", line 24, in _func
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/commands/utils.py", line 204, in export_fixtures
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/utils/fixtures.py", line 64, in export_fixtures
    export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"), filters=filters)
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/core/page/data_import_tool/data_import_tool.py", line 63, in export_json
    for doc in frappe.get_all(doctype, fields=["name"], filters=filters, limit_page_length=0, order_by="creation asc"):
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/__init__.py", line 960, in get_all
    return get_list(doctype, *args, **kwargs)
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/__init__.py", line 933, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/model/db_query.py", line 66, in execute
    result = self.build_and_run()
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/model/db_query.py", line 74, in build_and_run
    args = self.prepare_args()
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/model/db_query.py", line 88, in prepare_args
    self.remove_user_tags()
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/model/db_query.py", line 181, in remove_user_tags
    columns = frappe.db.get_table_columns(self.doctype)
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/database.py", line 754, in get_table_columns
    return [r[0] for r in self.sql("DESC `tab%s`" % doctype)]
  File "/home/amitha/frappe-erpnext/apps/frappe/frappe/database.py", line 147, in sql
    self._cursor.execute(query)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/amitha/frappe-erpnext/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, "Table '50e397e7e0.tabCustom Fields' doesn't exist")

Its Custom Field not Custom Fields in hooks.py

1 Like

@kolate_sambhaji

Thanks, now error is vanished!
But when I do migrate it shows

Migrating erpnext.local
Updating frappe                     : [========================================]
Updating erpnext

Here, erpnext.local is not the site, I am using…
I have another site.

@Amalendu
bench --site "your-site-name" migrate

@kolate_sambhaji
Again, accept my thanks for your patience

When i did bench --site ally1 migrate
it shows :cry:
Migrating ally1
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpnext/frappe-civil/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/erpnext/frappe-civil/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-civil/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-civil/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-civil/apps/frappe/frappe/commands.py”, line 202, in migrate
frappe.init(site=site)
File “/home/erpnext/frappe-civil/apps/frappe/frappe/init.py”, line 121, in init
local.conf = _dict(get_site_config())
File “/home/erpnext/frappe-civil/apps/frappe/frappe/init.py”, line 175, in get_site_config
raise IncorrectSitePath, “{0} does not exist”.format(site_config)
frappe.exceptions.IncorrectSitePath: 404: Not Found

Are you running command from frappe-bench folder?, also please check site name in frappe-bench/sites folder

1 Like

@kolate_sambhaji
Yes, Running from frappe bench folder.

Oops, in my local machine, the currentsite.txt is ‘ally1’
and in server it is ‘erpnext.local’

I think, this is the reason for the issue. right?
Can i directly change the site name in ‘currebtsite.txt’ file
from ‘erpnext.local’ to ‘ally1’ in server? or any other commands to run?

try running bench --site all migrate

This is not issue. for server you need to run bench migrate --site erpnext.local to update erpnext.local site

1 Like

@kolate_sambhaji
Actually I need 'ally1 'site… not ‘erpnext.local’.

bench migrate will just update site data, so you need to run bench migrate on production server with production server site name.

2 Likes

@kolate_sambhaji

It again not working… Actually doctype fields are showing and functionalities are working…
The problem is with the child table…

Why even bench migrate is not working…
How can I resolve this?

check git status on your local server.
Also for child doctype on local server, check Is Custom is unchecked or not.
Check files are present/created for child doctype.

1 Like

@kolate_sambhaji

Thank you so much for your sincere help…

Yes, it was the problem that, the ‘custom’ checkbox of child table was in checked state!
I unchecked that.
Then i did a Push.
And from server I did a bench Update.
Now, the changes in the child table reflects there… Everything is working fine…

Even now I don’t understand what is the need of that ‘custom’ checkbox. :open_mouth:

Thank you @kolate_sambhaji

1 Like

@Amalendu If Custom checkbox is checked, then json files will not be created. It only update database.

2 Likes