-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Do not print the bill addr. name when there's none #5561
Do not print the bill addr. name when there's none #5561
Conversation
It's pretty worrying that we have an order in production without a billing address. I wonder if this change will reduce visibility of some underlying issue. Maybe we could add a quick |
I agree that currently it is not possible to order without a billing address. This is weird. @sauloperez do you know how many case we have in production? |
this is empty in live uk, fr, au and katuma: This looks like someone is trying invoice generation on an order that is not completed. |
This is also empty on these 4 instances, I dont understand: |
btw, isn't this linked to #5405 ? |
I checked in Katuma but approaching it differently select *
from spree_orders
left join spree_addresses
on spree_addresses.id = spree_orders.bill_address_id
where state = 'complete'
and spree_addresses.id is null
order by spree_orders.id desc limit 1; but 0 results as well. Might something only affecting AU? It must be this:
I also want to confirm whats the impact of the issue because I bet a single order causes the whole print in bulk to fail. |
another example but now in orde_cycle_management report: https://app.bugsnag.com/open-food-france/open-food-france-prod/errors/5ee107d3dd8f6c0018b1c294?event_id=5ee107d3005b7d7f3d660000&i=sk&m=nw |
Hi @sauloperez , I think this is possible to reproduce without manually removing the address from the DB. If one tries to print an order without a name/address, for example: Bugnsag is triggered:
So, I staged this PR in staging-AU (in this case, although I reproduced the scenario in three stagings, see https://openfoodnetwork.slack.com/archives/CEF14NU3V/p1593007455366300) hoping to be able to "bulk-print" this order. It triggered a similar error, but concerning the "full address": Perhaps the next stage would be to remove the address from a healthy order, and see it bulk-printing still works - help needed here (no access to staging-au). |
I tested this further on staging-fr and printed out the healthy order R527511207, which worked fine: This is the order in the DB:
After that, deleted the bill adress ID with the command: Which seems to have worked (hooray!):
After that, I tried repeating the bulk print-job and got the expected error: This looks related to the findings from @RachL while testing PR #5353. After staging the PR in staging-fr, the result does not change: Editing this (complete) order and printing the invoice generates an error 500: Perhaps this PR needs a second look @sauloperez ? Should something else be tested here, for now? |
Yes, I see the billing addres is being referenced a couple more times. Thanks for the testing @filipefurtad0 ! |
The error ``` ActionView::Template::Error: undefined method `full_name' for nil:NilClass ``` happens a few times a day and raises exceptions we don't pay attention to. They add unnecessary noise that hides other more relevant issues. This, however, is a symptom of a deeper data integrity problem that needs solving at some point. This is just a countermeasure.
e76cc5a
to
2317876
Compare
I fixed the missing parts and now I can confirm it works on my machine while before didn't @filipefurtad0 |
Hey @sauloperez , Re-staged the PR, and got the same results as before on order R527511207: Bulk printing (this order), while on /admin/orders: Editing the order and printing the order, i.e., the link:
triggers error 500, as before. Moving back to In Dev. |
It seems there's an issue the staging server and it has nothing to do with this PR. This is what I seen in the logs
I'll see if I manage to fix it and back to you @filipefurtad0 |
that locale must have been active at some point and then removed. |
did it actually update any row? because I was just chechking |
no sorry, that was meant for @luisramos0 . I'm redeploying this branch again now. |
I deleted my comment, but was too late :-) |
Pretty good testing @filipefurtad0 👏 . I totally missed that we have two invoice templates that can be configured from /admin/invoice_settings/edit. Now this invoice renders as well. |
yes Pau, 3 users had en_GB. |
Thank you @sauloperez ! 🚀 Did you mean to move it to All the things? I would think this is ready to be tested now, right? |
Oh yes, I don't know when I moved it back. I must have mixed it with another one. |
Hey @sauloperez , Both print options - bulk or under /order//edit - now work and yield the respective invoices according to the set template: Ready to go! 🎉 |
Oh, finally! thanks a lot for thorough testing @filipefurtad0 ! |
What? Why?
The error
happens a few times a day and raises exceptions we don't pay attention to. They add unnecessary noise that hides other more relevant issues.
This, however, is a symptom of a deeper data integrity problem that needs solving at some point. This is just a countermeasure.
What should we test?
Check that the invoice is correctly displayed when the billing address is set. Let me know when you are testing the opposite scenario and I'll manually remove the address. I don't know how else to reproduce it.
Release notes
Make the invoice handle the inconsistent scenario where the order has no billing address.
Changelog Category: Changed