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

fix(sales): add sales user to read stock settings for js refresh code path #37317

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

blaggacao
Copy link
Contributor

Context

frappe.db.get_single_value("Stock Settings", "enable_stock_reservation").then((value) => {
if (value) {
frappe.db.get_single_value("Stock Settings", "auto_reserve_stock_for_sales_order").then((value) => {
// If `Reserve Stock on Sales Order Submission` is enabled in Stock Settings, set Reserve Stock to 1 else 0.
frm.set_value("reserve_stock", value ? 1 : 0);
})
} else {
// If `Stock Reservation` is disabled in Stock Settings, set Reserve Stock to 0 and read only.
frm.set_value("reserve_stock", 0);
frm.set_df_property("reserve_stock", "read_only", 1);
}

^^ This is a code path exercised by evey Sales User when e.g. creating a new sales order.

However the Sales User, alone, doesn't have access to Stock Settings.

This is clearly not working as intendet because there's no way a User with only Sale User role can actually, well, create a new Sale Order.

Every such time, the user is greated with a permission error message and the potentially important default setting on stock reservation is silently ignored as if it was disabled.

Proposed Solution

  • Give Sale User role read-only access to Stock Settings.

@deepeshgarg007 deepeshgarg007 merged commit fb7c5f6 into frappe:develop Oct 10, 2023
12 of 13 checks passed
@blaggacao blaggacao deleted the fix/sales-user-permissions branch October 10, 2023 20:38
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants