xTuple.com xTupleU Blog & News Customer Support

Maintenance Orders and Associated Parts are being deleted when work order is marked complete

Since May 2016 when we upgraded to Xtuple 4.9.3 and Fixed Asset Maintenance 1.6.3 I have had completed work orders vanish from the maintorder table and the maintparts table.  Currently I have to restore various backups so I can find 10 missing work orders.  Does anyone know why this is happening?

I can think of no reason why Maintenance Orders would just vanish, unless they were manually deleted.  It is possible to manually delete maintenance Orders from the Asset or Maintenance Order list screen.

Normal workflow would be to process a work order and then "complete" that order.  Completed orders do not appear on the Maintenance Order list unless the "Show Completed" filter is selected.

I just went step by step to reproduce the error.

See attached document

Unfortunately I have installed the 1.6.3 Maintenance package and followed your steps and still cannot reproduce the problem.  Please install the latest Maintenance package (which I have sent you) and see if that resolves it on your system.

I just recreated this, and it will delete the records if you follow these steps:

Create a Main Order, Save it
Edit the order, but add a date in the Actual Finish, Change the status to Completed, click save
(The order is still in the database)
Edit the Order again, A message will appear that the order is complete and the screen will close and the order is deleted from the database.
See the code below that it calls. 

I did recreate this this and when you follow the instruction it will delete the order and parts from the database.
I have temporarily commented out this section of the code in maintOrder script

function closeEvent()
{
if (!_saved)
{
// var del = toolbox.executeQuery("DELETE FROM assetmaint.maint_order WHERE (maintorder_id = <? value('orderid') ?>);", {orderid: _orderid});
// asset.errorCheck(del);
}
}

I did not research why this was there, assuming if there was a true Maintenance you wanted to delete then this may do it.

 


I have updated the bug

 http://www.xtuple.org/xtincident/view/bugs/28917