openfoodfoundation / openfoodnetwork

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

Error 422 - Unable to create or update an OC when adding a particular supplier AND selecting one or several of his products #3730

Open RachL opened 5 years ago

RachL commented 5 years ago

Description

With the data of one hub in France, I've seen that I couldn't create an OC by adding a particular supplier to it and at the same time selecting either one or several or all his products.

To make it work, I need to first add the supplier, save and then select his products. You need to select them after saving once the OC with this supplier in incoming

With ALL of his other suppliers I can create an OC with all products selected.

Steps to Reproduce

  1. Login with an account that has access to this hub data (I can give you the details on slack)
  2. Go to order cycle
  3. Create an order cycle with all his suppliers except Commes "un"
  4. Select all products (or even just a few, but inside each suppliers)
  5. The OC will save correctly

Now repeat all these steps but with Commes "un". When you hit "create" you will face an error 422.

Now repeat all these steps but when you add Commes "un", dont select its products. The OC will be created with no errors. You will be able to select the products afterwards,

Animated Gif/Screenshot

image.png

Severity

bug-s4: it's annoying, but you can use it

Your Environment

myriamboure commented 5 years ago

Question @RachL it seems the problems come when you add the supplier which is also the OC coordinator... am I right ? Maybe that will give us a clue, this supplier has a specific role in the OC if I'm not mistaken.

RachL commented 5 years ago

@myriamboure no actually there is only one OC coordinator which is the hub, not the supplier :( One other clue is that the hub told me that for this supplier specifically they change some products from item to weight and reverse. I still have to do some tests to see if this could have lead to some errors.