Cannot create purchase or Sales invoice

Continuing the discussion from Customer data won't load:
Trying to create a Sales invoice , error message as follows:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 855, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 65, in getdoctype
docs = get_meta_bundle(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 75, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 20, in get_meta
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 145, in hget
value = generator()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 20, in
meta = frappe.cache().hget(“form_meta”, doctype, lambda: FormMeta(doctype))
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 32, in init
self.load_assets()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 39, in load_assets
self.add_code()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 62, in add_code
self._add_code(_get_path(self.name + ‘.js’), ‘__js’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 77, in _add_code
js = get_js(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 185, in get_js
return render_include(js)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/utils/init.py”, line 46, in render_include
with open(frappe.get_app_path(app, app_path), ‘r’) as f:
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 645, in get_app_path
return get_pymodule_path(app_name, *joins)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 660, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).file), *joins)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 622, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named selling

@smino please change the subject to explain your problem, this subject will not help you at all…

also, where are you trying to make the invoice? API or Web Browser?

screenshots are welcomed…

I am using the virtual machine from the website with bench updates. It seems that the modules in Accounts are crashing with similar errors:

ImportError: No module named buying

ImportError: No module named selling

User setting have all modules enabled, and the user has access to them.

I wondered if the problem could be related to : https://discuss.frappe.io/t/customer-data-wont-load/11980

Screenshot: http://imgur.com/xZ7N1Ji

Thanks.

You could check whether this frappe issue applies to you: ImportError when accessing Erpnext's selling/buying docs · Issue #1725 · frappe/frappe · GitHub

I had upgraded , and essentially reinstalled bench and erpnext when I saw this post and was importing .csvs only to find the problem still exists. Inasmuch as my git fu is not strong, I am left wondering how to proceed, since it appears the problem is not due to some customization that I had done.

I tried this in the vm: cd bench-repo, then git checkout 41f972c. The pathspec is notr known to git. What is the correct way to checkout the fix? Or can I presume that this will be fixed in an update of erpnext itself?

Edit: I have managed to restore the site using bench --force restore ~/path/to/backup.sql, however the problem still exists.


@smino Go go frappe-bench/apps/frappe then git checkout 41f972c and subsequently you restart the server (I use bench clear-cache && bench restart).

If this is indeed the same problem for you, it will be fixed in Frappe for sure.

Success!

It fixed it. However this issue remains: https://discuss.frappe.io/t/customer-data-wont-load/11980

Many thanks.

@smino I just noticed that I was indeed on develop the whole time in the VM, not on master. I don’t know how I managed to switch though… So you should just switch to master and all your problems will disappear :wink:

The output of: git show branch , in ~/frappe-bench/apps/frappe

! [develop] Merge branch ‘KanchanChauhan-WebsiteChanges’ into develop

  • [HEAD] [fix] context frappe.local.request
  • [develop] Merge branch ‘KanchanChauhan-WebsiteChanges’ into develop
  • [develop^2] [css] cleanup + moved products and homepage to erpnext + [fix] get_js
  • [develop^2^] Website Changes
  • [develop^] [cleanup] control get_value for dialog fields
  • [develop~2] [enhancement] sort selector
  • [develop~3^2^2] bumped to version 6.27.14
  • [develop~3^2^2^] [fix] Load private files having non-ascii characters when using Nginx’s X-Accel-Redirect system
  • [develop~4^2] [feature] Redirect to message page with a detailed message
  • [develop~5] [fix] regex
  • [develop~6] [enhancements] now can {% include %} in page js files and also write jinja like tags in js templates
    +* [HEAD] [fix] context frappe.local.request

Can I just issue: git checkout master , in that directory then to correct?
Sorry for lack of git mastery.

@smino git branch -a will show your current branch and all available branches:

`frappe@erpnext:~/frappe-bench/apps/frappe$ git branch -a

  • master
    remotes/upstream/HEAD → upstream/develop
    remotes/upstream/bot
    remotes/upstream/develop
    remotes/upstream/gh-pages
    remotes/upstream/hotfix
    remotes/upstream/master
    remotes/upstream/v4.x.x
    remotes/upstream/v5.x.x
    `

git remote show upstream will show you if your remote is set up properly.

`frappe@erpnext:~/frappe-bench/apps/frappe$ git remote show upstream

git checkout master will indeed change your branch to master.

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:

http://imgur.com/Q0jEWyQ

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:
apps.tx
beat.schedule
common_site_config.json
celerybeat.pid
currentsite.txt
languages.txt

and folders:

erpnext.vm
assetsl

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