Cascade workflow activities (completing chained documents) exception problem

Description

A problem was found on cascade activities not doing correctly the rollback:

Test case for GardenWorld (note this test case could not be reproduced if the is fixed, but is possible there are other chained documents that are completed in workflows creating the same issue):

  • Create a Sales Order:

    • Type = Prepay Order

    • Payment Rule = Cash

  • Create an order line with one Seeder product and complete the order

  • it must be left in "Waiting Payment" status

  • Create a Payment that pays the sales order

  • complete it:

    • The user is notified with an error "Validation Error Invoice Paid" and the payment is left in "In Progress" status

    • but if you check the sales order related documents you can see that the related shipment and invoice documents where created - they must be rolled back

The cause is because every workflow activity is treated independently in a chain of documents, and the class MWFActivity:875 creates a Savepoint for every document.
So, the allocation throws an error, rollback to its own savepoint (reversing JUST the allocation) - and the rest of documents are completed and committed.

A possible patch can be:

But would be better to test carefully the impact on other cases.

Environment

None

Assignee

Carlos Ruiz

Reporter

Carlos Ruiz

Labels

None

Tested By

None

Fix versions

Priority

Major
Configure