Can't delete an order

In order to delete (or archive) an entreprise or an order cycle, we need to be able to delete (or archive) an order. Because we can’t delete an entreprise or order cycle if orders or products or E2E or … are attached to it.

We can only “cancel” an order today, but it stays attached to the order cycle, and distributor, and we can’t delete the shipping method and the distributor. Here is an exemple with Vikabraten Butikk, we created two hubs for the same farmer, to test and now I can’t delete this one.

We are stuck here for the moment, so our database starts to be very much in a mess (for the admins) as we see all the dozens of entreprises en order cycles we have created to make tests, demos, etc. (we only have a production environment in Norway)

I understand it can be dangerous to allow delete entreprise with attached orders, but I guess:

  • either then we should be able to “archive” (and the orders attached will be archived as well). In case of mistake or need to go into the history, we can look into the archives.
  • either give the choice to the super admin to archive or delete (if it’s a test or demo, better to delete, no sense to archive)
  • or depending on if we are in a staging or production environment, in production nothing can be deleted, and in staging you can choose between “delete” and “archive”.

If there are other things attached the system could show them (the orders, E2E, order cycles,etc.) and ask if we want to delete/archive everything. (this should apply not only to orders, but to all elements we want to delete in OFN)

What are your thoughts on that? Anything in the pipeline already?

@sstead @danielle @Kirsten

I suspect that you actually need some dev level data clean-up - I had to sit with @oeoeaio one afternoon and do this in our database. Is pretty painful. When he’s back from holiday he may be able to provide some instructions on how best to do this?

one thing you can do in the meantime is clearly label things that you don’t want or are duplicate e.g. ‘DELETE enterprise’ so that you can clearly see which one NOT to use in the backend.

Thank you @Kirsten, @sigmundpetersen do you know how to do the clean up in the database? I guess we should do that when our Staging server is in place so that we don’t pollute it again to make some trial and simulation, ideally…