Skip to content
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

BOM doesn't work anymore #3655

Closed
myriamboure opened this issue Mar 26, 2019 · 22 comments
Closed

BOM doesn't work anymore #3655

myriamboure opened this issue Mar 26, 2019 · 22 comments
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.

Comments

@myriamboure
Copy link
Contributor

Description

In BOM, if I change the weight of an ordered product, the price displayed is correctly dynamically adapted but it's impossible to save the new weight.

(tested on French production AND Katuma staging)

Expected Behavior

I can adjust the real weight of the received product (ex: chicken) and the price adapt accordingly, and this new value can be saved and apply to the given order.

Actual Behaviour

Impossible to save the new weight value in BOM.

Steps to Reproduce

  1. Make an order of one unit of a per kg product.
  2. As hub manager, order, BOM (https://staging.katuma.org/admin/orders/bulk_management) check the product you just ordered. Make sure the columns "weight/volume" and "price" are displayed.
    3.Change the weight to 1500 instead of 1000. You see the price dynamically changing. But you see also that the field is surrounded by red line.
    4.Try to save : error ("the red fields contain errors"). The dev tool doesn't show anything, it doesn't react at all as if nothing was happening !

Animated Gif/Screenshot

Capture du 2019-03-26 15-33-04
Capture du 2019-03-26 15-33-52

Context

I was doing a test for another bug on shipping method fees calculated per kg, apparently they don't update when the weight of the products is updated through BOM. I'm not able to test until this is solved.

Severity

If someone else can reproduce I would say S2 this is a feature which is pretty used with not really workaround (how to fill in the real kitchen weight ?)

Your Environment

  • Version used: v1.29
  • Browser name and version: Chrome
  • Operating System and version (desktop or mobile): Ubuntu 1.18
  • OFN Platform instance where you discovered the bug, and which version of the software they are using : French production + Katuma staging
@myriamboure myriamboure added the bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. label Mar 26, 2019
@luisramos0
Copy link
Contributor

I'll have a look

@luisramos0
Copy link
Contributor

luisramos0 commented Mar 26, 2019

ok, I think I understand it.

it's because in the BOM you are seeing, there is an order with an item with quantity ZERO. if you edit the order where the line item quantity is zero and move that quantity to 1 or more, the error will disappear from all other orders and items. deleting the item from the order directly on the BOM will also fix the problem.
the cause is a division by zero here:

pristine_unit_value = LineItems.pristineByID[lineItem.id].final_weight_volume / LineItems.pristineByID[lineItem.id].quantity

the description would be: an order with a weight calculated item with quantity zero will break BOM.

can you please check this is true?

it looks like a edge case with a workaround so I'd tag it s3.

@luisramos0 luisramos0 assigned luisramos0 and unassigned luisramos0 Mar 26, 2019
@luisramos0
Copy link
Contributor

un-assigning myself as I am not fixing it today if it's s3.

@myriamboure
Copy link
Contributor Author

Ok I'll check tomorrow morning

@myriamboure
Copy link
Contributor Author

myriamboure commented Mar 27, 2019

Ok I see lots of lines with zero quantity, it must have been problematic for the user as the price has not changed even if volume has been put to zero...

I asked the user what he wanted to do to try to fix it, as it's on production I can't just delete the lines if they are actually still used in an order. It's pretty annoying, now with guest orders I don't see the name and date of the order in BOM. Don't know if it was like that before but I have no way to find the concerned orders.

Capture du 2019-03-27 09-43-17

@myriamboure
Copy link
Contributor Author

@luisramos0 did you fix the problematic lines on Katuma staging ? I tried to see if your solution works there but I can't reproduce anymore.

@luisramos0
Copy link
Contributor

ah, yes, I have fixed the offeding line item in katuma staging. You just need to edit the order and put a quantity zero.
ah, the BOM doesnt let you move the quantity to zero! so, to reproduce you need to edit the order and change thee quantity in the single order edit page. I did it for Yogurt: 1L, you should now see it broken again.

@luisramos0
Copy link
Contributor

"I see lots of lines with zero quantity," in the screenshot I see lots of zeros in poids/volume, quantities are not zero...

@myriamboure
Copy link
Contributor Author

Yes sorry you are right I wrote too quickly ;) But still I can't know what are the corresponding orders and what the users wanted to do ;-) Anyway, I retest on Katuma and rephrase as you suggest.

@myriamboure
Copy link
Contributor Author

This is strange, now on Katuma if I try to put a product with volume = 0 (like here apple 2kg) I can't save ! How did the user put the volume to 0 ??? Any idea @luisramos0 ?
Capture du 2019-03-27 10-13-11

@myriamboure
Copy link
Contributor Author

Ah sorry I get it, forget my comment @luisramos0 ;-) Broken because your one liter yogourt ;-)

@myriamboure
Copy link
Contributor Author

No, it's broken... Arghhh ! So now I have deleted your probematic yogourt. I can modify the volume/weight, it's not broken. But I can't put any weight/volume to 0. So how did the user do on French production ? @luisramos0 if you have a clue...

@luisramos0
Copy link
Contributor

yes, one single broken line item will break the full page. if you fix that line item all the lines in the page will just work again.

@luisramos0
Copy link
Contributor

yeah, I see. you cant really move the volume to zero either.
the zeros in the screenshot are probably for variants that are not weight based.
so, if the variant is weight based you cant have zero weight. is this true for French prod data?

@myriamboure
Copy link
Contributor Author

Unfortunately not @luisramos0 the product "olives noires 500g" on french prod is in Kg... and the volume/weight is to 0 :-(

@myriamboure
Copy link
Contributor Author

Ahhhh ! I think I found the bug, the product is set up per kg, but nb of unit of the variant is 0,5 (displayed 500g), BUT the user has left a space between the , and the 5, he wrote 0 ,5 !!!

@myriamboure
Copy link
Contributor Author

But the volume/weight is still to 0... I have an error message saying "certain variants don't have a nb of unit"... it is still displayed...

@myriamboure
Copy link
Contributor Author

Capture du 2019-03-27 10-27-30

@myriamboure
Copy link
Contributor Author

Ok so I found another bug, if you write a unit with a "," it makes the system bug, you can write 0.5 (kg) in the variant unit but not 0,5. Now I can access again the volume/weight column.
Capture du 2019-03-27 10-29-38

@myriamboure
Copy link
Contributor Author

Ok so I have no way to reput the original weight/volume but as the price is correct I won't touch it. I can back update the other BOM weight/volumes. So the cause of the problem was how the nb of unit was filled in, I'll open another issue to explain it. I think we can just close that issue as there is no possiblity to move quantity or volume/weight to zero from BOM. Thank you @luisramos0 for your help, your clues and tests helped me find the problem ;-)

@luisramos0
Copy link
Contributor

awesome, thanks!

@myriamboure
Copy link
Contributor Author

Here is the new issue, closing this one #3660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.
Projects
None yet
Development

No branches or pull requests

2 participants