fix: add permission check for get_item_details (#57515)

This commit is contained in:
Diptanil Saha
2026-07-28 16:08:40 +05:30
committed by GitHub
parent a051a12d9b
commit 5835709402
4 changed files with 24 additions and 2 deletions

View File

@@ -77,6 +77,7 @@
{ {
"fieldname": "default_warehouse", "fieldname": "default_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Warehouse", "label": "Warehouse",
"options": "Warehouse", "options": "Warehouse",
@@ -94,6 +95,7 @@
{ {
"fieldname": "default_discount_account", "fieldname": "default_discount_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Discount Account", "label": "Discount Account",
"options": "Account" "options": "Account"
}, },
@@ -101,6 +103,7 @@
"description": "Stock account where inventory value for this item will be tracked", "description": "Stock account where inventory value for this item will be tracked",
"fieldname": "default_inventory_account", "fieldname": "default_inventory_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Inventory Account", "label": "Inventory Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -151,6 +154,7 @@
"description": "Cost center used for tracking purchase expenses for this item", "description": "Cost center used for tracking purchase expenses for this item",
"fieldname": "buying_cost_center", "fieldname": "buying_cost_center",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Buying Cost Center", "label": "Buying Cost Center",
"options": "Cost Center", "options": "Cost Center",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -167,6 +171,7 @@
"description": "Account where the cost of this item will be debited on purchase", "description": "Account where the cost of this item will be debited on purchase",
"fieldname": "expense_account", "fieldname": "expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Expense Account", "label": "Expense Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -175,6 +180,7 @@
"description": "Provisional liability account used for service items before invoice is received", "description": "Provisional liability account used for service items before invoice is received",
"fieldname": "default_provisional_account", "fieldname": "default_provisional_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Provisional Account (Service)", "label": "Provisional Account (Service)",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -183,6 +189,7 @@
"description": "Account to record additional purchase expenses like freight or customs", "description": "Account to record additional purchase expenses like freight or customs",
"fieldname": "purchase_expense_account", "fieldname": "purchase_expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Purchase Expense Account", "label": "Purchase Expense Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -191,6 +198,7 @@
"description": "Used to balance the books when recording extra purchase costs", "description": "Used to balance the books when recording extra purchase costs",
"fieldname": "purchase_expense_contra_account", "fieldname": "purchase_expense_contra_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Purchase Expense Contra Account", "label": "Purchase Expense Contra Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -199,6 +207,7 @@
"description": "Account to track value added to stock via Stock Entry, Stock Reconciliation or Landed Cost Voucher", "description": "Account to track value added to stock via Stock Entry, Stock Reconciliation or Landed Cost Voucher",
"fieldname": "expenses_added_to_stock_account", "fieldname": "expenses_added_to_stock_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Expenses Added To Stock Account", "label": "Expenses Added To Stock Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -207,6 +216,7 @@
"description": "Used to balance the books when recording expenses added to stock", "description": "Used to balance the books when recording expenses added to stock",
"fieldname": "expenses_added_to_stock_contra_account", "fieldname": "expenses_added_to_stock_contra_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Expenses Added To Stock Contra Account", "label": "Expenses Added To Stock Contra Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -215,6 +225,7 @@
"description": "For Standard Cost items: the purchase price vs standard rate difference is booked here. Falls back to the Company's Default Purchase Price Variance Account.", "description": "For Standard Cost items: the purchase price vs standard rate difference is booked here. Falls back to the Company's Default Purchase Price Variance Account.",
"fieldname": "purchase_price_variance_account", "fieldname": "purchase_price_variance_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Purchase Price Variance Account", "label": "Purchase Price Variance Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -223,6 +234,7 @@
"description": "For Standard Cost items: the Manufacture/Repack consumed cost vs standard rate difference is booked here. Falls back to the Company's Default Manufacturing Variance Account.", "description": "For Standard Cost items: the Manufacture/Repack consumed cost vs standard rate difference is booked here. Falls back to the Company's Default Manufacturing Variance Account.",
"fieldname": "manufacturing_variance_account", "fieldname": "manufacturing_variance_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Manufacturing Variance Account", "label": "Manufacturing Variance Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -288,6 +300,7 @@
"description": "Cost center used for tracking sales revenue for this item", "description": "Cost center used for tracking sales revenue for this item",
"fieldname": "selling_cost_center", "fieldname": "selling_cost_center",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Selling Cost Center", "label": "Selling Cost Center",
"options": "Cost Center", "options": "Cost Center",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -296,6 +309,7 @@
"description": "Account where revenue from selling this item will be credited", "description": "Account where revenue from selling this item will be credited",
"fieldname": "income_account", "fieldname": "income_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Income Account", "label": "Income Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -325,6 +339,7 @@
"description": "Account where cost of goods sold will be posted when this item is sold", "description": "Account where cost of goods sold will be posted when this item is sold",
"fieldname": "default_cogs_account", "fieldname": "default_cogs_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "COGS Account", "label": "COGS Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -348,6 +363,7 @@
"depends_on": "eval: parent.enable_deferred_expense", "depends_on": "eval: parent.enable_deferred_expense",
"fieldname": "deferred_expense_account", "fieldname": "deferred_expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Expense Account", "label": "Expense Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -356,6 +372,7 @@
"depends_on": "eval: parent.enable_deferred_revenue", "depends_on": "eval: parent.enable_deferred_revenue",
"fieldname": "deferred_revenue_account", "fieldname": "deferred_revenue_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Revenue Account", "label": "Revenue Account",
"options": "Account", "options": "Account",
"show_description_on_click": 1 "show_description_on_click": 1
@@ -406,7 +423,7 @@
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2026-07-15 10:00:00.000000", "modified": "2026-07-28 15:39:44.848087",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Default", "name": "Item Default",

View File

@@ -36,6 +36,7 @@ class ItemDefault(Document):
parenttype: DF.Data parenttype: DF.Data
purchase_expense_account: DF.Link | None purchase_expense_account: DF.Link | None
purchase_expense_contra_account: DF.Link | None purchase_expense_contra_account: DF.Link | None
purchase_price_variance_account: DF.Link | None
selling_cost_center: DF.Link | None selling_cost_center: DF.Link | None
# end: auto-generated types # end: auto-generated types

View File

@@ -1,5 +1,6 @@
{ {
"actions": [], "actions": [],
"allow_bulk_edit": 1,
"autoname": "hash", "autoname": "hash",
"creation": "2013-03-07 11:42:59", "creation": "2013-03-07 11:42:59",
"doctype": "DocType", "doctype": "DocType",
@@ -18,6 +19,7 @@
"columns": 3, "columns": 3,
"fieldname": "warehouse_group", "fieldname": "warehouse_group",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Check Availability in Warehouse", "label": "Check Availability in Warehouse",
"options": "Warehouse" "options": "Warehouse"
@@ -26,6 +28,7 @@
"columns": 2, "columns": 2,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Request for", "label": "Request for",
"options": "Warehouse", "options": "Warehouse",
@@ -59,7 +62,7 @@
"in_create": 1, "in_create": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2025-12-02 16:02:23.254963", "modified": "2026-07-28 15:54:36.089238",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Reorder", "name": "Item Reorder",

View File

@@ -86,6 +86,7 @@ def get_item_details(
for_validate = parse_json(for_validate) for_validate = parse_json(for_validate)
overwrite_warehouse = parse_json(overwrite_warehouse) overwrite_warehouse = parse_json(overwrite_warehouse)
item = frappe.get_cached_doc("Item", ctx.item_code) item = frappe.get_cached_doc("Item", ctx.item_code)
item.check_permission()
validate_item_details(ctx, item) validate_item_details(ctx, item)
doc = frappe.parse_json(doc) doc = frappe.parse_json(doc)