-
Notifications
You must be signed in to change notification settings - Fork 6
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
backend: several issues related to the "stock out" endpoints #87
Conversation
"check" doesn't really imply a side-effect and is confusing. "split" describes better what it does (even if it doesn't always split, the end goal is the same).
This is actually an issue in the core stock module, which is fixed locally as it is much more likely to happen in shopfloor than any other places (and the consequences if it happens in shopfloor have no workaround, while you can still edit the move lines when it happens on the UI). Reported as odoo/odoo#58491 The details about the issue are there. In short: calling _action_assign on a stock.move create/write package levels which may in turn replace the "result_package_id" of a move line, even if it was already set by a user. To prevent this, we skip the package level sync when: * any line related to the package has a result_package_id set * any line related to the package has a qty_done set Depending on the response of odoo to this issue, we may later remove this commit partially or completely.
When we create a stock issue, create an inventory with the quantity of units to keep. The quantity to keep is the quantity of products which have been picked (qty_done > 0). To do so, we unreserve the move lines in the location where qty_done == 0, so remain only the picked ones, and when creating the inventory, we sum the move lines quantities. As the state of a move line is a related to the move, we have to include "partially_available" ones. It is important to keep the domain on the state to exclude cancel and done moves, and it should be more efficient to filter on assigned/partially_available than to exclude all the others. A scenario where it was observed is: In a location, we have 2 packages: * Pack1: 2 units * Pack2: 100 units We create a move for 100 units, it creates 2 move lines: * 2 units from Pack1 * 98 units from Pack2 In the application, we scan Pack1, move only 1 unit to a destination Bin. The next line is shown for the remaining unit of Pack1, we use the "stock out" button. At this point, what we expect: * The inventory for Pack1 is created with 1 unit (to satisfy the first unit put in the destination Bin) Before the correction: * The inventory for Pack1 is created with 0 unit, because the move is "partially_available", so the move line for the picked unit is ignored. I researched for other occurrences where we do not search for "partially_available" on move lines and fixed them.
c854cdb
to
43d3d38
Compare
Codecov Report
@@ Coverage Diff @@
## 13.0-shopfloor #87 +/- ##
==================================================
+ Coverage 91.06% 92.61% +1.54%
==================================================
Files 55 55
Lines 3972 3979 +7
==================================================
+ Hits 3617 3685 +68
+ Misses 355 294 -61
Continue to review full report at Codecov.
|
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.
by reading commit messages seems legit :)
See the commits for details
ref 1647