Validate change of Attribute set instance on order lines when the qty reserved > 0
Description
Environment
Attachments
- 08 Feb 2019, 07:41 PM
is duplicated by
Activity
Carlos Ruiz November 30, 2021 at 3:09 PM
Just to be sure - I repeated the test cases described in the forum thread and everything worked fine.
Carlos Ruiz March 24, 2019 at 6:32 PM
Backed out the inital fix. This requires a more complex solution, maybe when releasing the reservation we would need to check what is the ASI that had the reservation and release from there.
Regards,
Carlos Ruiz
Carlos Ruiz March 21, 2019 at 8:20 PM
Reopening as there is a broken use case explained at:
https://groups.google.com/d/msg/idempiere/KbJM5hlA-U4/7wNwIz_iAAAJ
My tests:
following the instructions provided in forum effectively doesn't allow to complete the material receipt
reverted the commit here and the material receipt can be completed - and the reservation is released properly
BUT: then the bug fixed here is reopened, the following test case failed after reverting the commit:
create purchase order without ASI
create material receipt with ASI not connected to the purchase order
match the PO with the MR
then two reservations are left in inventory +1 and -1 (That's the bugs fixed here)
Even WITH the commit here the case is failing on MatchPO - so, solution is working for sales, but purchase will require a different treatment.
Diego Ruiz February 8, 2019 at 7:42 PM
Hi @Carlos Ruiz,
Attached you can find the patch that solves this ticket.
Kind Regards,
Diego Ruiz
Currently the system is letting the user change the attribute set instance after the order is prepared, which creates a qty reservation that is not linked to any document.
Steps to reproduce:
Create an order
Create an order line with a product with ASI and set an existing instance
Prepare the order
You see a reservation in storage detail with the qty set in the order line
Go back to the order line and update the instance field selecting a different one
Complete the order
Create a Shipment for that order line
Observe in Storage Detail that the records created in #2 are still present.
The solution is to extend the existing validation that does not allow to update the product or delete an order line when qtyReserved > 0, to not allow the change of the ASI value.