Repository navigation
fix(checkout): guest order still fails with PermissionError on live - #7
Merged
Merged
Conversation
1.1.2 set quotation.flags.ignore_permissions, but that only covers permission checks on the Quotation document itself. The actual failure, confirmed via a full traceback on production (ERPNext 16.35.0), is erpnext.stock.get_item_details.get_item_details() calling item.check_permission() directly on a separate Item document - a check that flag never reaches. Dev runs an older ERPNext (16.19.1) without that check, which is why it never reproduced there. place_order() now runs quotation building, pricing/tax calculation and submission under a temporary Administrator elevation (_run_as_system_user()), restored to the real session user immediately after (verified: session is back to the customer, not stuck elevated, once the block exits). Checkout no longer depends on which Item (or other business doctype) permissions happen to be configured for a customer's role on a given site. Release 1.1.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
quotation.flags.ignore_permissions, but that only covers permission checks on the Quotation document itself.erpnext.stock.get_item_details.get_item_details()callingitem.check_permission()on a separate Item document - a check that flag never reaches. Dev runs an older ERPNext (16.19.1) without that check, which is why it never reproduced there.place_order()now runs quotation building, pricing/tax calculation and submission under a temporary Administrator elevation (_run_as_system_user()), restored to the real session user immediately after. Checkout no longer depends on which Item (or other business doctype) permissions happen to be configured for a customer's role on a given site.Release 1.1.3.
Test plan
bench consoleon the production site itself (same account that failed in the browser), confirmingitem.check_permission()inget_item_details.pyas the failure point.