ImportError: cannot import name update_item_projected_qty

Hi,
when running bench update we get the following:

File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/patches/v7_0/update_item_projected.py", line 5, in execute
    from erpnext.stock.doctype.bin.bin import update_item_projected_qty
ImportError: cannot import name update_item_projected_qty

bench version
erpnext 10.1.42
frappe 10.1.39

bench setup requirements
Updating Python libraries…
INFO:bench.utils:./env/bin/pip install --upgrade pip==9.0.3
Requirement already up-to-date: pip==9.0.3 in ./env/lib/python2.7/site-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
INFO:bench.utils:./env/bin/pip install -q -r /home/erpnext/bench-repo/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/s3_backup/requirements.txt
Updating node packages…
INFO:bench.utils:npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
npm WARN frappe@ No description

The usual advice is to run ‘bench update’ again

“npm WARN notsup SKIPPING OPTIONAL DEPENDENCY”

the above warning can be ignored (apparently)

Thank you for your response.

We tried bench update with and without --reset but still get ImportError, it seems there is a problem when executing:

erpnext.patches.v7_0.update_item_projected

We could try to skip the patch, but as @rmehta stated here, it is NOT RECOMMENDED:

Well the import fails since this method update_item_projected_qty is not present in erpnext/bin.py at develop · frappe/erpnext · GitHub

That method was added with this 14 April 2016 commit [enhancement] heatmaps on item and notifications for item · frappe/erpnext@15a7f21 · GitHub

The question is what became of that method since then, which commit removed it etc and why?

Then will it be solved in an upcoming version? Should we raise a github issue for this?

Yes probably report it on github.

I can’t grok why that method is missing, whether or why you are an isolated case?

I have no current environment of my own handy right now to troubleshoot…

An update - on 13 Feb 2018 update_item_projected_qty was removed with this commit

Remove total_projected_qty (#12889) · frappe/erpnext@5a91989 · GitHub

on this basis

[hotfix] Remove total_projected_qty by netchampfaris · Pull Request #12889 · frappe/erpnext · GitHub

FTW I found the commit only by manual inspection; I tried but could not find it via the command line with for example this:

frappe@ubuntu:~/frappe-bench/apps/erpnext$ git log -S update_item_projected_qty ./erpnext/stock/doctype/bin/bin.py

as advised here How do I "git blame" a deleted line? - Stack Overflow

edit: a working example Find where code was deleted in a Git repository - Stack Overflow

1 Like

I have pushed a fix to hotfix branch to remove the patch. It will be released to master soon. But as of now, you can comment out the patch from patches.txt and go ahead.

2 Likes