[FIX] stock: make package level package consistent
Currently a package level is created and has the newly created package assigned to it when "Put In Pack" is used. Unfortunately if a move line has its result_package_id changed after having a package assigned via the Put In Pack, then the package level's package_id isn't correctly updated. This leads to incorrect data in the db. This incorrect data doesn't affect much since result_package_id from an entire package move cannot be changed in any views, but it does mean that the created package associated with the package level can never be deleted even if it's never used. Steps to reproduce: 1. active (delivery) packages in settings 2. create a picking and create some done values 3. use "Put In Pack" to put done move lines into a package 4. change the newly created Destination Package to another package 5. Go to Packages and try to delete the package created by Put In Pack Expected result: able to delete the package Actual result: Server error that package is still required by Stock Package Level. This is a short term fix. In the long run it would be better to fix the package_level logic so it isn't unnecessarily assigned to moves/move lines and/or updates in a cleaner way. Task ID: 2418907 closes odoo/odoo#66386 X-original-commit: e5ab8cf9 Signed-off-by:Arnold Moyaux <amoyaux@users.noreply.github.com>
Please register or sign in to comment