Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (Stock Reco) Ignore Empty Stock while fetching items from warehouse #26726

Merged

Conversation

marination
Copy link
Collaborator

@marination marination commented Jul 29, 2021

  • Added Ignore Empty Stock Checkbox in Fetch Items from Warehouse popup
    Screenshot 2021-07-29 at 7 41 36 PM
Working while checked:

with-empty-stock

Working while unchecked:

wo-empty-stock


Additional Fix:

  • Made sure Items are not fetched twice. This happened due to additionally querying from Item Defaults table after querying from Bin. To replicate: Add a warehouse as default warehouse in Item, and use same warehouse to fetch items in stock reco
  • Before:
    Screenshot 2021-07-29 at 7 50 31 PM
  • After:
    Screenshot 2021-07-29 at 7 49 52 PM

no_docs

…ouse

- Added checkbox to `Fetch Items from Warehouse` dialog to ignore empty stock
- fix: Items fetched twice due to Item Defaults
- Improved code readability
@marination marination added backport version-13-hotfix needs-tests This PR needs automated unit-tests. labels Jul 29, 2021
@rohitwaghchaure rohitwaghchaure merged commit 383c49c into frappe:develop Jul 29, 2021
@frappe-pr-bot
Copy link
Collaborator

The backport to version-13-hotfix failed:

The process '/usr/bin/git' failed with exit code 128

fieldtype: 'Link',
options: 'Warehouse',
reqd: 1,
"get_query": function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also be written as:

get_query() {

Succinct, ain't it?

# check if item-warehouse key extracted from each entry exists in set iw_keys
# and update iw_keys
iw_keys = set()
items = [item for item in items if [(item.item_code, item.warehouse) not in iw_keys, iw_keys.add((item.item_code, item.warehouse))][0]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hard to read

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty clever though

asoral pushed a commit to asoral/erpnext that referenced this pull request Nov 12, 2021
…empty-stock

feat: (Stock Reco) Ignore Empty Stock while fetching items from warehouse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport version-13-hotfix needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants