Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After deleting a product I can't cancel an order containing that product #5335

Closed
lin-d-hop opened this issue Apr 30, 2020 · 19 comments · Fixed by #8778
Closed

After deleting a product I can't cancel an order containing that product #5335

lin-d-hop opened this issue Apr 30, 2020 · 19 comments · Fixed by #8778
Assignees
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. hackathon Issues for upcoming hackathons

Comments

@lin-d-hop
Copy link
Contributor

lin-d-hop commented Apr 30, 2020

Description

Once a product has been soft-deleted it still appears in orders placed.

If I then want to cancel that order I cannot.

message = 'You need to save the variant to create a stock item before you can set stock levels.'

https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/5da4ec3ec076fc0019b57ad6?filters[event.since][0]=30d&filters[error.status][0]=open

Expected Behavior

I want to be able to cancel orders that contain deleted products

Actual Behaviour

I cannot cancel an order than contains a deleted product

Steps to Reproduce

  1. Create an order with a product
  2. Delete the product
  3. Cancel the order
  4. Death by slug

Animated Gif/Screenshot

Workaround

Possibly by recreating the product and then cancelling the order? I haven't tested this.

Severity

bug-s3: a feature is broken but there is a workaround of adding a negative adjustment.
I'm not sure if there is a workaround. This seems to mostly impact people making test orders on the system. This doesn't seem to impact people so often once they start trading.

Your Environment

  • Version used: UK 2.9.6
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

@lin-d-hop lin-d-hop added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label Apr 30, 2020
@lin-d-hop
Copy link
Contributor Author

@RachL
Copy link
Contributor

RachL commented Apr 30, 2020

😱 and here I am deleting products for one of my users.... too late :'(

@Matt-Yorkley
Copy link
Contributor

Matt-Yorkley commented Apr 30, 2020

I wrote a spec related to this yesterday. When a variant is soft-deleted it's stock item is hard-deleted...

@Matt-Yorkley
Copy link
Contributor

Cancelling the order obviously tries to restock the deleted variant.

@Matt-Yorkley
Copy link
Contributor

Matt-Yorkley commented May 1, 2020

I don't think there's a workaround here, but it should be fairly simple to fix.

@luisramos0
Copy link
Contributor

v3 brought soft deletion to stock items, I wonder if this one is solved...

@filipefurtad0
Copy link
Contributor

For a newly created on_demand variant and after placing the order with it, it seems possible to and delete this variant (which is perhaps useful information to add to #5947). After deleting this variant, it's possible to reproduce this bug by attempting to delete the order:

image

Bugsnag:
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/5f2ab6c5e81dc80018dea912?event_id=5f526da0005dec4b9a3f0000&i=sk&m=nw

@RachL RachL added the hackathon Issues for upcoming hackathons label Sep 25, 2020
@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Jan 6, 2021

Cancelling the order obviously tries to restock the deleted variant.

That makes sense @Matt-Yorkley . Also, it's not possible to remove or refund those items, from the previously placed orders:

image

This was reported here, by @Cecilia-Hn :
https://openfoodnetwork.slack.com/archives/CG7NJ966B/p1609931360401700?thread_ts=1609927942.401600&cid=CG7NJ966B

@ghost
Copy link

ghost commented Mar 26, 2021

localhost_3000_admin_orders_R445323256_fire_e=cancel

  • Product, Variant, Stock Item, Line Item, Order when deleted or canceled must be soft deleted always so that data stays in the DB but is hidden from the admin
  • Also there must be a way to un-delete (re-create) the deleted Products, Variants, Stock Item, Line Item, Order
  • DELETED Product is soft deleted verified by this open_food_network_dev=# Select * from spree_products where deleted_at is NOT null;

I tried to un-delete the previously deleted product and its variants but get following error:-

localhost_3000_admin_products_1616744684_delete-this-product-and-cancel-order_variants

@ghost
Copy link

ghost commented Mar 26, 2021

I have fixed this on my local dev machine .. will be writing test, committing, and requesting pull ..

@filipefurtad0
Copy link
Contributor

Thank you @cmittal791!
I'll assign you to this issue 👍

@ghost
Copy link

ghost commented Mar 26, 2021

Thanks!

@Matt-Yorkley Matt-Yorkley assigned ghost Mar 27, 2021
@ghost ghost mentioned this issue Mar 29, 2021
@ghost ghost mentioned this issue May 12, 2021
@andrewpbrett andrewpbrett unassigned ghost May 15, 2021
@meronogbai
Copy link
Contributor

I will pick up this one.

@filipefurtad0
Copy link
Contributor

Thank you @meronokbay for picking this up!
I've assigned you to the issue. Please let us know if you have any questions.

@meronogbai
Copy link
Contributor

I won't be able to address this issue anytime soon, because life is getting hectic for me. Hopefully, someone else can pick it up.

@meronogbai meronogbai removed their assignment Oct 6, 2021
@sigmundpetersen
Copy link
Contributor

OK no worries @meronokbay . Thank you for your contributions so far, hope to see you back another time 💪

@filipefurtad0 filipefurtad0 mentioned this issue Oct 29, 2021
8 tasks
@RonellaG
Copy link

We have a producer (Enterprise 3452) that has deleted 2 products and now wants to cancel order R455001031 that contains them but cannot because of this bug.

As far as I can see there is no workaround for this. This producer sells seasonal products and this is likely to happen again for them.

For now I am going to suggest they make a negative adjustment for the value of the order and name the adjustment "Zeroing order as unable to cancel order for deleted products".

@georgethoppil
Copy link
Contributor

I can take a look at this if no one else is

@sigmundpetersen
Copy link
Contributor

Sure, go ahead @georgethoppil . Thank you 🎉

There was a previous attempt at this in #7622 that you could take a look at if you want.
It was only missing additional specs I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. hackathon Issues for upcoming hackathons
Projects
Development

Successfully merging a pull request may close this issue.

9 participants