From 2d04e7141271eaded41d53bbc9a22b37fbd5816f Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Wed, 17 Aug 2022 15:57:41 +0530 Subject: [PATCH] fix: Make expense account editable in Subcontracting Receipt Item (#31848) --- erpnext/controllers/stock_controller.py | 8 +++++++- .../subcontracting_receipt.js | 7 +++++++ .../subcontracting_receipt_item.json | 14 +++++++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 49f85cdba5..36bed36484 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -322,7 +322,13 @@ class StockController(AccountsController): ) if ( self.doctype - not in ("Purchase Receipt", "Purchase Invoice", "Stock Reconciliation", "Stock Entry") + not in ( + "Purchase Receipt", + "Purchase Invoice", + "Stock Reconciliation", + "Stock Entry", + "Subcontracting Receipt", + ) and not is_expense_account ): frappe.throw( diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js index b2506cd143..35fec8bc33 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js @@ -48,6 +48,13 @@ frappe.ui.form.on('Subcontracting Receipt', { is_group: 0 } })); + + frm.set_query("expense_account", "items", function () { + return { + query: "erpnext.controllers.queries.get_expense_account", + filters: { 'company': frm.doc.company } + }; + }); }, refresh: (frm) => { diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json index e2785ce0cd..bf15f0f688 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json +++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json @@ -49,11 +49,12 @@ "col_break5", "batch_no", "rejected_serial_no", - "expense_account", "manufacture_details", "manufacturer", "column_break_16", "manufacturer_part_no", + "accounting_details_section", + "expense_account", "accounting_dimensions_section", "project", "dimension_col_break", @@ -363,10 +364,8 @@ { "fieldname": "expense_account", "fieldtype": "Link", - "hidden": 1, "label": "Expense Account", - "options": "Account", - "read_only": 1 + "options": "Account" }, { "collapsible": 1, @@ -456,12 +455,17 @@ "no_copy": 1, "print_hide": 1, "read_only": 1 + }, + { + "fieldname": "accounting_details_section", + "fieldtype": "Section Break", + "label": "Accounting Details" } ], "idx": 1, "istable": 1, "links": [], - "modified": "2022-04-21 12:07:55.899701", + "modified": "2022-08-15 11:34:00.970042", "modified_by": "Administrator", "module": "Subcontracting", "name": "Subcontracting Receipt Item",