openfoodfoundation/openfoodnetwork

Reset absent products in Import page does not work

Opened this issue · 9 comments

Description

If I import a product list and I mark "Set stock to zero for all exiting products not present in the file"
imagen

it does not set to zero the products not present in the file imported
imagen

Expected Behavior

set "on hand" to cero

Actual Behaviour

remains last value

Steps to Reproduce

  1. Import product list
  2. check product not in the file
  3. product doesn't set to cero

Workaround

Severity

bug-s2

Your Environment

  • Version used:
  • Browser name and version: Firefox and Chrome
  • Operating System and version (desktop or mobile): Windows 11

Possible Fix

Hi @Trementinaire - I did a spike on this and here are the findings:

  • Only those products are reset to zero stock that are supplied by the producers mentioned in the file
  • For example, you are creating or updating the products by "Farmer A" as producer in the file
  • Only those products are reset to zero stock that is supplied by "Farmer A" if the check is marked
  • Can you please confirm the functionality again and see if you observe the above behavior?

@RachL - I think this functionality is misleading a bit as the checkbox suggests that it would reset all the products regardless of the suppliers mentioned in the file. Please let me know if I'm missing something here. Thanks.

Hi @chahmedejaz, I only do it with one supplier. This functionality was working until one and a half month. I see that the products that it does not reset are because there have a negative values in the “on hand” field. May be it can be fixed if this field only accept positive values.

See this
imagen

RachL commented

@mkllnk maybe this is a regression due to the DFC order stock management work?

Also I detect too that import create a variant istead of update the product
imagen

The screenshot shows a stock level of -30. But I think that you see that only if you untick the on demand box, right?

Until recently, on demand products always had a stock level of zero. So I guess that the product import didn't reset it. But now we do store the number of sold stock in that field. It's usually not visible. I think that we have to update the product import to set stock levels of on-demand products to zero as well.

import create a variant istead of update the product

I wonder if that's due to our product refactor work.

@Trementinaire, can you supply CSV files that demonstrate the issue?

I think it's this issue maybe 😅:
#12968

Hi @Trementinaire can you test if this is still happening?