-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Backoffice order blocked at 'Address' stage #7337
Comments
Thanks for reporting this @lbwright22 . I first observed this yesterday while testing this PR #6924. I second your observation, on
Not sure what is the pattern for these orders. It seems to affect both admins and customers. Depending on the extent, could be an s1... Investigating. |
For these orders, it appears that shipments are missing from the A corrupt order:
A "healthy" order:
|
In fact, it looks like there are only 8 (!!!) shipment entries in this table - there are 4790 orders in
The last one is from 2021-04-06 16:19:37. This would match with the date and time of deployment of PR #6924 on staging-UK. But this PR was staged/tested in other servers, and the orders seem not to be missing there... I'm puzzled here. Ping @Matt-Yorkley. |
I think I was trying some things out on UK Staging the other day before 6924 was deployed, there's a good chance it was me that deleted the shipments there. Sorry! I'll take a look at restoring a backup. I think it's separate from this issue in UK Production though. Deploying PRs to staging that were not merged before the last release can't be the cause of the issue in UK Prod, right? |
Going back to this comment: #6924 (comment) I also manually replicated something like this the first time it came up. Switching the toggle and restarting unicorn made the shipment section re-appear on the order I was looking at (in staging), but it didn't really make sense. |
Thanks @Matt-Yorkley an no worries on that - restoring the orders might be an idea, deleting them as well would be fine.
Right 👍 It all matched with the time of the deployment of the patch, so for a moment I thought PR #6924 was in it (but it's not). We should probably remove the default setting to enable unit prices (or features which are in development) from staging environments - I think this was a conclusion from our meeting on this matter (cant' find the notes now). Update: submitted PR #7350 |
I was able to reproduce this issue by downloading the UK database and trying to place an order containing one of the subscription coffee products. I'm not all that familiar with the inventory parts of the code base, but I was able to track this down and it was happening because it's saying there's no stock available for the item. In the database dump that I have, that OrderCycle has the following products available:
But when I look at the inventory for New Dawn, none of those products appear. Again, this might be me misunderstanding what @lbwright22 mentions about:
But from what I'm looking at, it does look like something isn't right with how inventory is working for this distributor. I also tested creating an order for another distributor/order cycle and was able to move the order to the payment state after entering customer details. We could probably downgrade this from an S2 given that it's apparently limited to just this shop and might be fixed by checking their setup, depending on what @lbwright22 thinks. In any case, though, we could look into making the error message more informative - right now, we expect that entering customer details should always advance the order state to payment, and don't indicate why if that doesn't happen. |
Actually, it looks like quite a few of these products in the order cycle - everything supplied by New Dawn traders in fact - has 0 on hand in the product list, and does not show up in the inventory. When creating a backoffice order, these products show up in the dropdown search as being able to add to the order. I don't know if that's a recent change/regression, but the immediate workaround would be to either add the product to inventory or change its quantity on hand to be > 0. |
Hi @andrewpbrett all of New Dawn Traders products are in the New dawn Traders Inventory with stock level over-rides. It just takes ages for them to load and show. They are already in stock in the inventory. Sorry... |
This is an S2. It would be an S1 with a report from another user. No backoffice orders. I have successfully placed a backoffice order on a different OC for this user but not with this OC. It seems something specific to the OC but I can't figure out why that might be... I just want to add to the description: Normal Behaviour:
On an order with these products for this enterprise in this order cycle you do not have the option to add the Shipping Method. And the line items do not display correctly as Louise described. In the below image NORMALLY i would see line items and the option to choose a Shipping Method. Why can't I choose a shipping method? I get blocked by Order State 'Address'. Why does this state transition occur? |
Thanks @lin-d-hop and @lbwright22 for clarifying. I'm going to put some notes here on what I've discovered so far, since I'm scratching my head and might need to explain it to a rubber duck. The first-level reason that we can't access the payments screen is that we assume that filling in customer details will transition the order from the Okay, so why isn't it happening? We call openfoodnetwork/app/models/concerns/variant_stock.rb Lines 91 to 101 in aca19ed
In this case, There's a bit of a red flag here because on Line 26 of the There are actually four different places we define a method called When creating the BO order, however, the dropdown uses the API::Variant::Serializer, which uses the So basically, the variant override is being ignored here. I can't imagine that this we changed something such that suddenly all variant overrides are being ignored, or we'd be hearing about it from more than just this shop. I'm not all that familiar with the inventory/variant override parts of the code base (although I'm becoming more familiar by the hour...). I'm going to hit publish on this comment in case someone else wants to pick up the trail from here but I'll also continue to work on it. |
🦆💯 |
Inventory / VariantOverrides / "scoping" variants is crazy and head-scratching is 100% expected 👌 So to continue the rubber-ducking; I think when that dropdown looks for variants, it's hitting openfoodnetwork/app/controllers/spree/admin/variants_controller.rb Lines 56 to 60 in 479897f
Which essentially finds variants and then in theory "overrides" them here before returning the results: openfoodnetwork/lib/open_food_network/scope_variants_for_search.rb Lines 69 to 74 in 479897f
The override process is a bit crazy but essentially it overwrites the attributes of the I suspect this part is actually working as intended, but I could be wrong. The next step after selecting a product via the dropdown is a POST request to |
Also worth mentioning here: I can reproduce this in development using the default seed data (Freddy's Farm etc) by doing the following:
So this isn't anything specific to the hub, or the order cycle; the variant override is simply being ignored when we go to check if there's available inventory in this way. I've confirmed that a VariantOverride exists for the Tomatoes variant I'm trying to add. This is starting to be one of those "how did this ever work" bugs... based on what we do in the shipments controller, (scoping the variant to take into account overrides) I made a change to I'll send a PR for others to review. |
Description
Create order in back office for enterprise 201078 using OC 207544 (also tested for OC 207889)
Unable to complete the order placement.
Can not access 'Payments' tab
Order remains with status = 'Address'
Product stock is overridden in inventory but inventory settings do not necessitate products being in the inventory for them to be added to an order cycle.
No tag rules
Products added to backoffice orders are in the corresponding OC and are in stock in inventory.
Enterprise has delivery shipping methods set up.
Tested another enterprise and back office order placement works as predicted.
Expected Behavior
Create order in back office for enterprise 201078 using OC 207544 (also tested for OC 207889)
Add product in 'Order Details'
Visit 'Customer Details' and add address
Visit 'Payments' and add a payment
complete the order
Actual Behaviour
Create order in back office for enterprise 201078 using OC 207544 (also tested for OC 207889)
Add product in 'Order Details'
Visit 'Customer details' and add address
click update
click on 'payments' to finalise order placement.
Taken back to 'customer details'
Revisit incomplete order and edit.
Products removed from 'Order Details' section. Fees remain only.
Steps to Reproduce
Create order in back office for enterprise 201078 using OC 207544 (also tested for OC 207889)
Add product in 'Order Details'
Visit 'Customer details' and add address
click update
click on 'payments' to finalise order placement.
Taken back to 'customer details'
Revisit incomplete order and edit.
Products removed from 'Order Details' section.
Observe Fees remain only.
Animated Gif/Screenshot
Workaround
Severity
bug s2
Your Environment
Possible Fix
The text was updated successfully, but these errors were encountered: