-
Notifications
You must be signed in to change notification settings - Fork 23.3k
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] stock: ensure reception report always uses quantity field #147815
[FIX] stock: ensure reception report always uses quantity field #147815
Conversation
addons/stock/tests/test_report.py
Outdated
self.assertEqual(len(delivery.move_ids_without_package), 2, "Delivery moves should have split into assigned + not assigned") | ||
self.assertEqual(len(delivery.move_ids_without_package.mapped('move_orig_ids')), 1, "Only 1 delivery + 1 receipt move should be assigned") | ||
self.assertEqual(len(receipt.move_ids_without_package.mapped('move_dest_ids')), 1, "Receipt move should remain unsplit") |
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.
The mapped
is not needed and I find the comment "Only 1 delivery + 1 receipt move should be assigned" not very helpful (I let a suggestion but feel free to not follow it)
self.assertEqual(len(delivery.move_ids_without_package), 2, "Delivery moves should have split into assigned + not assigned") | |
self.assertEqual(len(delivery.move_ids_without_package.mapped('move_orig_ids')), 1, "Only 1 delivery + 1 receipt move should be assigned") | |
self.assertEqual(len(receipt.move_ids_without_package.mapped('move_dest_ids')), 1, "Receipt move should remain unsplit") | |
self.assertEqual(len(delivery.move_ids_without_package), 2, "Delivery moves should have split into assigned + not assigned") | |
self.assertEqual(len(delivery.move_ids_without_package.move_orig_ids), 1, "Delivery move should be linked to 1 assigned receipt move") | |
self.assertEqual(len(receipt.move_ids_without_package.move_dest_ids), 1, "Receipt move should remain unsplit") |
But I'm not sure, maybe checking records' values (qty and move's origin) instead is better to ensure the split was correctly done ?
self.assertEqual(len(delivery.move_ids_without_package), 2, "Delivery moves should have split into assigned + not assigned") | |
self.assertEqual(len(delivery.move_ids_without_package.mapped('move_orig_ids')), 1, "Only 1 delivery + 1 receipt move should be assigned") | |
self.assertEqual(len(receipt.move_ids_without_package.mapped('move_dest_ids')), 1, "Receipt move should remain unsplit") | |
self.assertRecordValues(delivery.move_ids_without_package, [ | |
{'product_qty': incoming_qty, 'move_orig_ids': receipt.move_ids_without_package.ids}, | |
{'product_qty': outgoing_qty - incoming_qty, 'move_orig_ids': []}, | |
]) | |
self.assertEqual(len(receipt.move_ids_without_package.move_dest_ids), 1, "Receipt move should remain unsplit") |
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.
Whoops, too fast with my copy paste for the mapped
part (pushed this change already)
For your other suggestions, I don't think they're necessary. There are 2 delivery moves after the action_assign
is called because it splits it between the linked qty and the not linked qty and then I check those values in the later asserts. I would prefer to avoid the test failing due to the order of the records changing since that part doesn't matter.
Since odoo#140898 the pickings detailed operation view has been moved to a smart button instead of showing in a picking tab. This included the removal of the `force_detailed_view` context since there was no longer a detailed view to force show. This commit removes some leftover references to this context within tests.
Following quantitypocalypse (odoo#137864), a couple of `reserved_uom_qty` and `reserved_qty` references were left over. This was partially due to no tests for these tricky parts of the code, therefore we both fix these references to use the newer `quantity`/`quantity_product_uom` fields and add/update tests to ensure we avoid breaking these 2 use cases again. Also discovered during this fix, the remaining assigned qtys when unassigning done incoming moves from already reserved outgoing moves (i.e. the "1. batch reserved + individual picking unreserved" use case in the code comments) was NOT being calculated correctly. This also fixes that + adds a test for it.
3e45eac
to
c65d7d9
Compare
robodoo r+ |
robodoo rebase-ff |
Merge method set to rebase and fast-forward. |
Since #140898 the pickings detailed operation view has been moved to a smart button instead of showing in a picking tab. This included the removal of the `force_detailed_view` context since there was no longer a detailed view to force show. This commit removes some leftover references to this context within tests. Part-of: #147815
Does a couple of small fixes
Removes some leftover post-quantitypocalypse field references that don't exist anymore for the reception report.
Also fix another bug where the unassign was keeping the incorrect link in the batch picking assign => individual picking unassign (wrong in stable too, but no one has complained since it's a rare use case so can be back-ported later if needed)
Removes obsolete
force_detailed_view
context reference from testsI confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr