-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
fix: erase UOMs when changing stock UOM #29062
Conversation
2506068
to
e823187
Compare
Codecov Report
@@ Coverage Diff @@
## develop #29062 +/- ##
===========================================
- Coverage 58.06% 57.75% -0.31%
===========================================
Files 1110 1107 -3
Lines 68007 67912 -95
===========================================
- Hits 39489 39225 -264
- Misses 28518 28687 +169
|
@Mergifyio backport version-13-hotfix |
erpnext/stock/doctype/item/item.py
Outdated
self.remove(d) | ||
else: | ||
d.idx = idx | ||
idx += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- mutating list while iterating over it will lead to runtime errors.
- it's simpler to just reset the index instead of this complicated logic. Once all modifications are done...
for idx, row in enumerate(doc.child_table, start=1):
row.idx = idx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just realized something very basic.
When stock UOM change, the old conversions don't make sense at all. They all need to be removed 😄
e.g.
- Nos is default stock UOM
- 20 Nos = 1 Box
- You change default stock UOM to Kg and now conversion is 20 Nos = 1KG now.
IMO lets just erase the whole table and show toast that UOM conversions are cleared.
7f82a71
to
d3806db
Compare
Issue- When item's default stock UOM is changed, the old conversion factors become unusable, erase UOM conversion list upon updating stock UOM.