openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.12k stars 723 forks source link

Delete a product that has been ordered and orders/invoices cannot be updated #4203

Open lin-d-hop opened 5 years ago

lin-d-hop commented 5 years ago

Description

A supplier loaded products onto OFN These products were ordered The supplier then decided they could not deliver the products and deleted them The order products cannot be removed from the orders, cannot be removed from invoices.

Expected Behavior

The soft-deleted products should still be able to be changed in while orders are not finalised.

Actual Behaviour

The soft deleted products cause errors in BOM and Edit Order. The specific products cannot be altered to 0 qty. The specific products cannot be deleted. In fact the order doesn't seem to be update-able at all.

Steps to Reproduce

  1. Create products from a supplier
  2. Order those products in an OC
  3. Delete the products
  4. Now edit the orders to try and change the quantities or remove the line items.
  5. Also try changing the line items in this order in BOM

Animated Gif/Screenshot

Screenshot from 2019-08-30 14-13-04

Context

A major UK hub is now having to send out incorrect invoices this week. They are having to manually process refunds, as opposed to being handled by Stripe. Quite an admin burden for them.

Severity

bug-s2: a non-critical feature is broken, no workaround

Your Environment

Possible Fix

This is almost certainly related to:

4053

3907

Also overlaps with: Product chain data model Invoicing and Delivery Note

lin-d-hop commented 5 years ago

Downgrading to s3. The user has reported that they are happy enough with the workaround and the case that created it was a bit exceptional.

sigmundpetersen commented 5 years ago

Okay I put this as test ready blocked by the merge of #4204 We test it after that one is merged and if not fixed we put it back to bug backlog

RachL commented 5 years ago

@lin-d-hop I'm not sure if I reproduced this right.... What happens at step 4 for you in production on the edit order page? Is there a button missing or an error?

lin-d-hop commented 5 years ago

There was an error (see image). Box goes red and error message 'Fields with Red Borders Contain Errors.

Hard to miss. If you didn't notice this then it's fixed :tada:

I'll leave to you to confirm and close @RachL

RachL commented 5 years ago

@lin-d-hop the screenshot is showing BOM, not order edit page. Did you had the same error on the edit page?

sigmundpetersen commented 5 years ago

This is now waiting for a merge of #4242 after which we can test/verify/reproduce more

luisramos0 commented 5 years ago

@RachL tested #4242, this can now be verified.

RachL commented 5 years ago

I can still reproduce the issue. Back to bug backlog.

This is for BOM:

image

And on edit order page, just nothing happens when you try to change quantity or remove item

luisramos0 commented 5 years ago

I can see it, there is no call to the server, some Javascript code on the BOM needs to be fixed now. I did have a look at this at some point but couldnt figure it out, some angular form validation goes wrong and blocks the form submission... @Matt-Yorkley you may be able to understand this.

lbwright22 commented 5 years ago

Testing: 1) add products to an order cycle 2) order products 3) delete products 4) try to edit the order by either deleting the product or reducing the quantity of the products which have been deleted. Can edit product quantity but new quantity doesn't save. Can't delete product from order. This is the same if you try to edit the order before or after the order cycle has closed. Product has been deleted from OFN totally and so doesn't appear even as an option when trying to change quantities by BOM

This issue has not been fixed

tschumilas commented 4 months ago

This bug is still around, or maybe back. On the edit orders page - clicking on the product that the producer has deleted, does not delete the product (no message). However, if the user re-calculates the order, per item fees associated with the product ARE deleted from the order.

Second, on the BOM page, the quantity of the deleted product cannot be adjusted, but the full quantity of the product can be deleted (trash can) here, and it successfully deletes from the order/invoice. So - this is really just a bug if the user needs to change the quantity of the item.