Bug 10984

Summary: Cannot cancel received order if the parent order is deleted
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: daniel.gaghan, julian.maurice, katrin.fischer, m.de.rooy, rcoert
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5336
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10869
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Jonathan Druart 2013-10-02 09:04:10 UTC
To reproduce:
- create an order with 2 items
- close the basket
- receive 1 item
- delete the order (with the remaining item)
- cancel the receipt
- nothing append
- cancel the receipt again
- an error occurred: "Cannot cancel receipt. Possible reasons : ..."
Comment 1 Jonathan Druart 2013-10-02 09:51:39 UTC
Katrin,

I don't know how to fix this issue.

I see 2 ways:

1/ Don't allow to delete order with children (but there will be no way to remove remaining items to receive)

2/ When an order is deleted and there are already received children, the parent_ordernumber for children become the ordernumber from the first order received (and we lost the link to the original order parent).
Example:
- O1 is pending with 3 items.
- receive 1 item: O2 is created (1 item received) and the parent_ordernumber is O1.
- receive 1 item: O3 is created (1 item received) and the parent_ordernumber is O1.
- now we have 01 (1 item to receive), O2 (1 item received) linked to O1, O3 (1 item received).
- cancel O1: O2 become the parent for O2 and O3 (we don't have the link to O1 anymore).
Restriction: we cannot cancel the receipt for O3 (we should cancel the receipt for O2 before).

Do you see a third way?
Comment 2 Katrin Fischer 2013-10-02 11:08:02 UTC
Hi Jonathan, 

Hm, I am not sure I have advice on this without replicating it - but i can't do that before tonight. :(
Comment 3 Daniel Gaghan 2022-08-18 16:54:26 UTC
Is this the error that accompanies this issue? "The order line you are trying to cancel was created from a partial receipt of another order line which has been deleted. Cancellation is not possible." 

If so it's still hanging around. Are there any ideas on a solution for this? 

-Daniel
Comment 4 Katrin Fischer 2022-10-01 08:11:37 UTC
(In reply to Daniel Gaghan from comment #3)
> Is this the error that accompanies this issue? "The order line you are
> trying to cancel was created from a partial receipt of another order line
> which has been deleted. Cancellation is not possible." 
> 
> If so it's still hanging around. Are there any ideas on a solution for this? 

At the moment you can only clean the data via SQL - there is a couple of bugs revolving around deleted records in acq.
Comment 5 Daniel Gaghan 2022-10-04 17:00:26 UTC
Ok, it sounds like this is still a problem. I will look for the bugs concerning this.