Quotation error and migration

while on version 4 we are experiencing error in sending pdf it keeps sending in html so i decided to try and migrate to 5 and gets this error in migrating. please help

   Executing erpnext.patches.v4_4.make_email_accounts in site1.local (site1.local)
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.9.2', 'console_scripts', 'frappe')()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/cli.py", line 40, in main
    ret = run(fn, args)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/cli.py", line 84, in run
    out = globals().get(fn)(**args)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/cli.py", line 68, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/cli.py", line 443, in latest
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v4_4/make_email_accounts.py", line 71, in execute
    account.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 206, in insert
    self.db_insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 197, in db_insert
    ), d.values())
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 129, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
frappe.exceptions.NameError: ('Email Account', u'Salesandsupport', IntegrityError(1062, "Duplicate entry 'Salesandsupport' for key 'PRIMARY'"))
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/cli.py", line 172, in update
    patch_sites()
  File "/home/frappe/bench-repo/bench/utils.py", line 91, in patch_sites
    exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))
  File "/home/frappe/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/home/frappe/frappe-bench/env/bin/frappe --latest all' returned non-zero exit status 1
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/cli.py", line 210, in _migrate_to_v5
    migrate_to_v5(bench=bench)
  File "/home/frappe/bench-repo/bench/migrate_to_v5.py", line 16, in migrate_to_v5
    exec_cmd("{bench} update".format(bench=sys.argv[0]))
  File "/home/frappe/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/usr/local/bin/bench update' returned non-zero exit status 1

PDF issues would be independent of this. I strongly suggest that you switch back to version 4 as version 5 is not ready for production use

Steps below,

  • Check if you have a backup that is recent enough (from sites/site1.local/private/backups)
  • Get back shopping cart bench get-app shopping_cart https://github.com/frappe/shopping_cart.git
  • switch back to master,
cd apps/frappe && git checkout master && cd -
cd apps/erpnext && git checkout master && cd -

If you decide otherwise and want to go ahead with v5,
in bench frappe --ipython, run

frappe.delete_doc('Email Account', 'Salesandsupport')

At the most, you might lose email settings.

thanks sir. i managed to restore it with a snapshot and fixed the pdf generating error with this

1 Like