Cannot create purchase or Sales invoice

I get the same error when clicking on any order (sales or purchase), nothing was modified before the last update, and I’m using the VM with erpnext pre installed.

Last time I got an error that was really similar to this, the team fixed the day after.

I did git checkout master , then for what I thought was good measure, a bench-update. The update starts out ok,. but it doesnt end well. Everything get up to date , then this:

Trying to login to the web intercace results in a blank page with:

Updating. We will be back in a few moments…

Rather stuck at this point.

Well, it’d be interesting to see why bench migrate fails, so maybe try bench migrate on its own. I suspect that switching from developer to master may pose some problems concerning the database. Maybe start a new site for testing.

The problem persists, none of the solutions presented worked for me…

@smino Any luck with your issue? I am stuck on the same page as yours. I also got that migrate error now.

I have been attempting to reinstall erpnext , then reload my sql backup. A first attempt at doing this resulted in the same errors etc.

At this point , I have renamed (mv) frappe-bench , bench-repo directories and deleted the config directory. Then , git cloned bench, pip installed bench repo, bench init frappe-bench and bench switch-to-master. Then bench setup config. At this point bench update produces no errors.

I installed erpnext using bench get-app. Bench update has no errors.

At this point I am unsure how re-create my site. What steps should I take prior to:
bench --site [sitename] --force restore /path/to/SQLFILE

Do i need to:
bench new-site mysite, then
bench --site mysite install-app erpnext
bench start

Or can I i copy from my renamed frappe-bench/sites or other directory?

@smino You need not have done so much. Your supervisor processes were not restarting and that’s what was causing the error.

If you still want to use the new bench you created, then you don’t need to restore the database as the database already exists in your system. Just move sites/yoursite folder into the new bench’s sites folder and then run:

bench setup nginx
sudo service nginx reload

The old frappe-bench/sites folder contains files:

and folders:


which should I copy?

@smino I suppose erpnext.vm is your site folder. Copy that folder into the new bench’s sites folder.

PS: what you are doing is in risky territory and you might end up even more frustrated

The login screen loads, there is a blank screen with header 502 error on login

Full screenshot?

Then after entering credentials, only the 502 header. Note that the progress bar on the bottom indicates the first two pages do not completely load.

@smino have you done customization in frappe/erpnext code?

Not in source code. I did add a custom field and customized a couple print formats in the UI. They were working without problems.

I will be afk for several hours btw, and I very much appreciate the help.

Are you on ERPNext VM?

@smino follow the instructions here: Errors After Upate v6.27.12 - #16 by anand

I am on a vm, however you can see from my earlier posts that I have reinstalled bench. And it is on master now.

I deleted the last frappe-bench then bench-init and followed this:

After bench start the terminal dispalys a bunch of ascii art , ending in this:

The browser displays the same 502 Bad Gateway error.

I have not attempted to restore my previous instance form the old sites or sql - this is a fresh erpnext instance.

@smino As I said before, you should not have deleted your old bench and started anew.

To fix this mess, you will need to cleanup your old setup first (from the top of my head):

sudo supervisorctl stop all
sudo service nginx stop
cd /etc/nginx/conf.d
rm frappe-bench.conf
cd /etc/supervisor.d # or something like that
rm frappe-bench.ini # or it could be frappe-bench.conf

cd /home/frappe/your-new-bench
bench setup redis
bench setup supervisor
bench setup nginx
sudo bench setup sudoers
sudo bench setup production frappe

sudo service nginx status
sudo supervisorctl status

You will need the frappe user’s password to run sudo which is frappe

Don’t run bench start!

Since you were using production setup, which is different from developer setup

I had planned nginx config replcacement , however not the supervisor. I did both and then the rest of the commands . I did get a login screen without 502. I did not login with admin , rather : bench --force restore the backup.sql, restarted nginx and supervisor.

When I log in a Administrator or as the user name , this box appears,

oops theres been a server error

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 25, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 91, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 107, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 114, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 127, in build_page
context = get_context(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 16, in get_context
context = build_context(context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/”, line 64, in build_context
ret = module.get_context(context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/templates/pages/”, line 21, in get_context
boot = frappe.sessions.get()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 107, in get
bootinfo[“notification_info”] = get_notification_info_for_boot()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 133, in get_notification_info_for_boot
out = get_notifications()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 26, in get_notifications
“open_count_doctype”: get_notifications_for_doctypes(config, notification_count),
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 92, in get_notifications_for_doctypes
filters=condition, limit_page_length = 21, as_list=True))
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 1016, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 72, in execute
result = self.build_and_run()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 92, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 147, in sql
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, “Unknown column ‘tabSupplier.status’ in ‘where clause’”)

bench-update this evening (00:47 GMT) and thing are looking much better.

1 Like