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 724 forks source link

stock control bug? #989

Closed OliverUK closed 8 years ago

OliverUK commented 8 years ago

Stroudco supplier Wharf Farm Product Goat's Milk Reset stock level set at 30 On hand stock was also set to 30 at the beginning of the OC. OC report shows 11 units ordered so far.

Products screen STILL shows 30 on hand! Inventory shows ZERO and THREE on hand!

AND I CAN'T EVEN MANUALLY MAKE MORE AVAILABLE TO SHOPPERS BECAUSE I STILL CAN'T SAVE THE INVENTORY SCREEN!

screen shot 2016-05-10 at 15 52 48 screen shot 2016-05-10 at 15 53 14 screen shot 2016-05-10 at 15 54 41

@NickWeir63 @lin-d-hop Maybe we can take off any inventory overrides through Super Admin and just not use them for now? I'll reset the stock levels manually after each OC.

OliverUK commented 8 years ago

I also don't understand what's happening with Fungusloci stock. We started with 10 on hand and 10 reset stock level. Now inventory and product screens show ZERO on hand but I can still select up to 9 in the shop front.

screen shot 2016-05-10 at 16 13 20 screen shot 2016-05-10 at 16 13 51 screen shot 2016-05-10 at 16 14 05

OliverUK commented 8 years ago

For Wharf Farm Duck Eggs, however, all looks fine, with all screens including shop front showing the right amount.

OliverUK commented 8 years ago

For our supplier Stroud Community Agriculture the stock reset levels have disappeared but the on hand stock looks right. SCA and Fungusloci may in theory have played with the settings and messed them up but Wharf Farm update their stock through me and don't log in themselves.

NickWeir63 commented 8 years ago

Hi @OliverUK this is what i see for wharf farm and fungusloci when logged in as superadmin. I will try taking off any inventory overrides ![Uploading Screenshot 2016-05-10 17.21.45.png…]() screenshot 2016-05-10 17 24 26

![Uploading Screenshot 2016-05-10 17.21.45.png…]()

NickWeir63 commented 8 years ago

OK wharf farm and funguslci are now set to 'inherit' so should take their settings from your bulk edit products list @OliverUK screenshot 2016-05-10 17 40 18

NickWeir63 commented 8 years ago

stroud community agriculture was set for everything to inherit apart from one variant (5kg potatoes). @OliverUK do you want me to change this? screenshot 2016-05-10 17 44 34

OliverUK commented 8 years ago

I think so Nick. Please could you do the same for Star Anise until we know what's going on?

NickWeir63 commented 8 years ago

OK Star Anise and SCA products are now all set to inherit

NickWeir63 commented 8 years ago

Thanks @stveep for taking this on. Let me know if you need more info

stveep commented 8 years ago

Hi @OliverUK

In the case of Fungusloci, it seems you are looking at the Inventory for the Fungusloci shop (which I can see is closed with no active order cycles from the shops page of the frontend), while Nick's screenshot is looking at Fungusloci products in the Stroudco shop. Stock levels set on the inventory page are specific to the shop that is selected, so to modify the shopfront stock level (9 in your post) that you are seeing in the Stroudco shop you would need to select the Stroudco shop (and Fungusloci producer) as in Nick's screenshot (similar to your Wharf farm screenshot). This should then decrease as orders are placed, which will be reflected in the [Stroudco] inventory page but not in the products page, since the stock is overriden by the Stroudco inventory and this determines how many are left for Stroudco shoppers to buy. Sorry if any of that is obvious, I'm trying to get my head around it properly too! Does that make sense?

When you say the Wharf Farm milk stock was set to 30 at the beginning of the OC, was this from the Bulk Product page or using the Inventory page (and if so, directly or by resetting to 30?). I'm wondering if you set the stock at 30/30 in the Products page, but this was being overriden by the Inventory, which would presumably have been set at 11x2pt and 14x1pt -resulting in the current values of 0/3 after 11 orders of each. The little warning triangle next to the product variant on the Product page is supposed to alert you to the fact that there is an inventory override in place for that product - but I think this could do with being made clearer...

I've just had a play on staging using Nick's account and it worked ok for me. I added two "Stroudco Food Hub" products to the order cycle: Elderflower cordial and Lemon cordial.

bulkedit

inv

Has the problem of saving inventory now been fixed?

OliverUK commented 8 years ago

Hello Steve, thanks for looking into this. Obviously some time has passed and I can't remember everything I did at the time but I can't see how I would have set the Wharf Farm stock in the wrong place (products) because only the inventory page has the reset levels. So by definition I would have been there. I do think the stock reset function is in the wrong place. If a producer can only make a certain amount each week, which is where we use this functionality, this needs applying at product level, surely? Another problem is that a producer cannot use the reset function unless they have a shop. But most producers don't want their own OFN shop. They just want to be able to set the availability of their produce.

Maybe I'm misunderstanding but can an inventory offer more stock for sale than the product's master stock level? And if so, does that make sense?

I still can't save the Stroudco inventory.

stveep commented 8 years ago

I believe that the reset stock function can only be used by the hub co-ordinator. This was the original idea for it: http://community.openfoodnetwork.org/t/inventory-reset/83

Giving a producer their own shop won't let them reset stock for the Stroudco shop as far as I know - any default levels that they set will only apply to the producer's own shop inventory (as I think is happening with your mushrooms above). The Inventory page, at least as I see it, is a way to maintain a stock of a product specific to a hub, separate from the 'master' stock of the product - and I think it can indeed be more than the master stock (see my Elderflower cordial example above). The use case I had in mind while developing the reset function, based on the discourse thread, was where the hub co-ordinator knows that a producer supplies the same amount of a product every order cycle. So to me it made sense to have it controlled by the hub co-ordinator, and only operating for inventory associated with the hub in question. In theory (though I guess this is not applicable to Stroudco producers at the moment) the master stock of a product could be supplied to and distributed by several different hubs. Whereas the stock levels set in inventory by the shop owner represent stock that the shop owner knows is available only for them to distribute - and this could be more than the producer has generally available (?).

We could look into adding a similar convenience method for producers to bulk reset stock levels of their products - but I think this would probably be done at the master level (If I understand correctly, this is supposed to represent stock held by the producer). Or maybe with appropriate permissions a producer could be given sufficient admin rights to reset hub stock levels of their own products.

I hope that makes sense. Pinging @oeoeaio to make sure I've got all this right...

OliverUK commented 8 years ago

It does make sense and I'm clear now that producers cannot change the reset level that we apply at hub level, although that's not how this thread started in any case. But you are right that we tried giving them shop fronts in order to allow them to set the default stock level available to the hub.

I'm still not sure if the confusion that started this thread isn't a bug. I can't get my head round how all the stock got in such a muddle. I'm however more than happy to be practical about it. For now, we will carry on without using this functionality, not least because we can't save changes in inventory. Once that is fixed, I will try once more and keep track of everything.

The scenario you describe is totally feasible but I wonder how common it is, considering that most instances where OFN is put into practice are surely still quite simple "single-hub" cases? I reckon even in a multi-hub environment the master stock should surely be a limit to what all distributors can sell?

OliverUK commented 8 years ago

@NickWeir63 I've changed suppliers from "shop" back to "profile" for all but SCA, where I'm no longer the enterprise owner and therefore can't change it. Could you do this?

NickWeir63 commented 8 years ago

@OliverUK I have changed SCA 'SELLS' from 'OWN' to 'NONE' (see below) and made Oliver@GMX the owner.
screenshot 2016-05-29 10 59 13

OliverUK commented 8 years ago

@stveep I can now save changes to the inventory again and will test more in the coming weeks.