Bench Update failed

Hello,

Bench update failed for site4 with followwing error,

Migrating site4.local
Executing erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice in site4.local (207f80aa38)
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/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/frappe/frappe-bench/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/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 207, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 27, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 26, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 60, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 80, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_0/repost_future_gle_for_purchase_invoice.py”, line 21, in execute
update_gl_entries_after(pi_doc.posting_date, pi_doc.posting_time, warehouses, items, wh_account)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 272, in update_gl_entries_after
voucher_obj.make_gl_entries(repost_future_gle=False)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 505, in make_gl_entries
update_outstanding=update_outstanding, merge_entries=False)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py”, line 19, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py”, line 86, in save_entries
make_entry(entry, adv_adj, update_outstanding)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/general_ledger.py”, line 94, in make_entry
gle.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 212, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 710, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 661, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 839, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 822, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 655, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 20, in validate
self.check_mandatory()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 52, in check_mandatory
frappe.throw(
(“Either debit or credit amount is required for {0}”).format(self.account))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 299, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 292, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 265, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Either debit or credit amount is required for Debtors - OPET
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 60, in update
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 90, in _update
patch_sites(bench_path=bench_path)
File “/home/frappe/bench-repo/bench/utils.py”, line 161, in patch_sites
run_frappe_cmd(‘–site’, ‘all’, ‘migrate’, bench_path=bench_path)
File “/home/frappe/bench-repo/bench/utils.py”, line 501, in run_frappe_cmd
raise CommandFailedError(args)
bench.utils.CommandFailedError: (‘–site’, ‘all’, ‘migrate’)

Hi,

This error occurred for site4.local.

All other three sites migrated successfuly

You have to debug yourself which document is giving the error while reposting GL Entry. While reposting somehow for a document system is trying to post GL Entries without any debit/credit amount. You have to check that document, have to identify and fix the document.

Otherwise, if you dont want to run that patch you can add a return statement at the beginning of the repost_future_gle_for_purchase_invoice patch. But it can lead to some existing wrong gl entries.