From 7e47b3809e958d4da7a770f6f79490abcd54082d Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 29 Nov 2023 19:49:58 +0530 Subject: [PATCH 1/3] fix(ux): make `basic_rate` field read-only based on purpose --- erpnext/stock/doctype/stock_entry/stock_entry.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 8cab438dd5b..13620a3d28b 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -258,7 +258,7 @@ frappe.ui.form.on('Stock Entry', { } } - if (frm.doc.docstatus===0) { + if (frm.doc.docstatus === 0) { frm.add_custom_button(__('Purchase Invoice'), function() { erpnext.utils.map_current_doc({ method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_stock_entry", @@ -311,7 +311,8 @@ frappe.ui.form.on('Stock Entry', { }) }, __("Get items from")); } - if (frm.doc.docstatus===0 && frm.doc.purpose == "Material Issue") { + + if (frm.doc.docstatus === 0 && frm.doc.purpose == "Material Issue") { frm.add_custom_button(__('Expired Batches'), function() { frappe.call({ method: "erpnext.stock.doctype.stock_entry.stock_entry.get_expired_batch_items", @@ -397,6 +398,10 @@ frappe.ui.form.on('Stock Entry', { frm.remove_custom_button('Bill of Materials', "Get items from"); frm.events.show_bom_custom_button(frm); frm.trigger('add_to_transit'); + + frm.fields_dict.items.grid.update_docfield_property( + 'basic_rate', 'read_only', frm.doc.purpose == "Material Receipt" ? 0 : 1 + ); }, purpose: function(frm) { -- GitLab From 998bb1266f0f7d222b0ee2b09444b065749afb07 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 30 Nov 2023 16:16:12 +0530 Subject: [PATCH 2/3] fix(ux): make PR `rate` field read-only having PO ref --- .../doctype/purchase_receipt_item/purchase_receipt_item.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index f938fb18b2c..35470944fbd 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -360,6 +360,7 @@ "oldfieldtype": "Currency", "options": "currency", "print_width": "100px", + "read_only_depends_on": "eval: (!parent.is_return && doc.purchase_order && doc.purchase_order_item)", "width": "100px" }, { @@ -1104,7 +1105,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2023-11-28 13:37:29.245204", + "modified": "2023-11-30 16:12:02.364608", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", -- GitLab From b66285c7c4991d4cff65dd448444febcb051a9ce Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 30 Nov 2023 16:28:03 +0530 Subject: [PATCH 3/3] fix(ux): make PI `rate` field read-only having PR ref --- .../doctype/purchase_invoice_item/purchase_invoice_item.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 36f9dab495a..9b20624d34d 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -292,6 +292,7 @@ "oldfieldname": "import_rate", "oldfieldtype": "Currency", "options": "currency", + "read_only_depends_on": "eval: (!parent.is_return && doc.purchase_receipt && doc.pr_detail)", "reqd": 1 }, { @@ -922,7 +923,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2023-11-13 20:26:18.329983", + "modified": "2023-11-30 16:26:05.629780", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", -- GitLab