AttributeError: 'SalesInvoice' object has no attribute 'account_for_change_amount'

Just got this error while running bench update

   Executing erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice in site1.local (1bd3e0294d)
    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/vef1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
        main()
      File "/home/vef1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
        click.Group(commands=commands)(prog_name='bench')
      File "/home/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
        return self.main(*args, **kwargs)
      File "/home/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
      File "/home/vef1/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/vef1/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/vef1/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/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/home/vef1/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/vef1/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
        ret = f(frappe._dict(ctx.obj), *args, **kwargs)
      File "/home/vef1/frappe-bench/apps/frappe/frappe/commands/site.py", line 206, in migrate
        migrate(context.verbose, rebuild_website=rebuild_website)
      File "/home/vef1/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
        frappe.modules.patch_handler.run_all()
      File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 26, in run_all
        if not run_single(patchmodule = patch):
      File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 60, in run_single
        return execute_patch(patchmodule, method, methodargs)
      File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 80, in execute_patch
        frappe.get_attr(patchmodule.split()[0] + ".execute")()
      File "/home/vef1/frappe-bench/apps/erpnext/erpnext/patches/v7_0/repost_future_gle_for_purchase_invoice.py", line 19, in execute
        update_gl_entries_after(pi_doc.posting_date, pi_doc.posting_time, warehouses, items, wh_account)
      File "/home/vef1/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 268, in update_gl_entries_after
        expected_gle = voucher_obj.get_gl_entries(warehouse_account)
      File "/home/vef1/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 517, in get_gl_entries
        self.make_gle_for_change_amount(gl_entries)
      File "/home/vef1/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 623, in make_gle_for_change_amount
        if self.account_for_change_amount:
    AttributeError: 'SalesInvoice' object has no attribute 'account_for_change_amount'
    Traceback (most recent call last):
      File "/usr/local/bin/bench", line 9, in <module>
        load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
      File "/home/vef1/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/vef1/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/vef1/bench-repo/bench/commands/update.py", line 90, in _update
        patch_sites(bench_path=bench_path)
      File "/home/vef1/bench-repo/bench/utils.py", line 161, in patch_sites
        run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
      File "/home/vef1/bench-repo/bench/utils.py", line 501, in run_frappe_cmd
        raise CommandFailedError(args)
    bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

This patch causing error…???

Hi @jof2jc,

This issue is fixed, kindly pull latest update and check.

Thanks, Rohit

1 Like

@rohit_w I’ve just been doing update and the error still persist??

Executing erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice in site1.local (1bd3e0294d)
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/vef1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/vef1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/vef1/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/vef1/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/vef1/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/vef1/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/vef1/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/vef1/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/vef1/frappe-bench/apps/frappe/frappe/commands/site.py", line 207, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/vef1/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 26, in run_all
    if not run_single(patchmodule = patch):
  File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 60, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/vef1/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 80, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/vef1/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/vef1/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 268, in update_gl_entries_after
    expected_gle = voucher_obj.get_gl_entries(warehouse_account)
  File "/home/vef1/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 536, in get_gl_entries
    self.make_gle_for_change_amount(gl_entries)
  File "/home/vef1/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 664, in make_gle_for_change_amount
    frappe.throw(_("Select change amount account"), title="Mandatory Field")
  File "/home/vef1/frappe-bench/apps/frappe/frappe/__init__.py", line 299, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red')
  File "/home/vef1/frappe-bench/apps/frappe/frappe/__init__.py", line 292, in msgprint
    _raise_exception()
  File "/home/vef1/frappe-bench/apps/frappe/frappe/__init__.py", line 265, in _raise_exception
    raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Select change amount account
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/vef1/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/vef1/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/vef1/bench-repo/bench/commands/update.py", line 90, in _update
    patch_sites(bench_path=bench_path)
  File "/home/vef1/bench-repo/bench/utils.py", line 161, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
  File "/home/vef1/bench-repo/bench/utils.py", line 501, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

Hi @jof2jc,

Can you share version details?

Thanks, Rohit

@rohit_w from v6.27 to v7

Thanks

Hi @jof2jc,

Have fixed this issue, kindly pull latest update and check

Thanks, Rohit

AttributeError: ‘SupplierGroup’ object has no attribute ‘lft’

will you solve this problem