From 0e1e37c921041137b9b91a63491af504873ca02d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 18:13:41 +0530 Subject: [PATCH] fix: Added Expense Account field to push value from PO-PR-PI --- .../doctype/purchase_order/purchase_order.js | 8 ++++++++ .../purchase_receipt/purchase_receipt.js | 12 ++++++++++-- .../purchase_receipt_item.json | 18 +++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index e63ef605b0..1134b0479e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -33,6 +33,14 @@ frappe.ui.form.on("Purchase Order", { } } }); + + frm.set_query("expense_account", "items", function() { + return { + query: "erpnext.controllers.queries.get_expense_account", + filters: {'company': frm.doc.company} + } + }); + }, refresh: function(frm) { diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 70c39ec53b..21513640ed 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -10,7 +10,7 @@ frappe.ui.form.on("Purchase Receipt", { frm.custom_make_buttons = { 'Stock Entry': 'Return', 'Purchase Invoice': 'Invoice' - } + }; frm.set_query("asset", "items", function() { return { @@ -18,7 +18,15 @@ frappe.ui.form.on("Purchase Receipt", { "purchase_receipt": frm.doc.name } } - }) + }); + + frm.set_query("expense_account", "items", function() { + return { + query: "erpnext.controllers.queries.get_expense_account", + filters: {'company': frm.doc.company} + } + }); + }, onload: function(frm) { erpnext.queries.setup_queries(frm, "Warehouse", function() { 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 b3e75ac91a..7c6ed1a64c 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -4,6 +4,7 @@ "doctype": "DocType", "document_type": "Document", "editable_grid": 1, + "engine": "InnoDB", "field_order": [ "barcode", "section_break_2", @@ -80,6 +81,7 @@ "rejected_serial_no", "section_break_50", "project", + "expense_account", "cost_center", "col_break5", "allow_zero_valuation_rate", @@ -245,6 +247,7 @@ "width": "100px" }, { + "default": "0", "fetch_from": "item_code.retain_sample", "fieldname": "retain_sample", "fieldtype": "Check", @@ -361,6 +364,7 @@ "read_only": 1 }, { + "default": "0", "fieldname": "is_free_item", "fieldtype": "Check", "label": "Is Free Item", @@ -482,6 +486,7 @@ "fieldtype": "Column Break" }, { + "default": "0", "fieldname": "is_fixed_asset", "fieldtype": "Check", "hidden": 1, @@ -620,6 +625,7 @@ "fieldtype": "Column Break" }, { + "default": "0", "fieldname": "allow_zero_valuation_rate", "fieldtype": "Check", "label": "Allow Zero Valuation Rate", @@ -635,6 +641,7 @@ "print_hide": 1 }, { + "default": "0", "depends_on": "eval:parent.is_subcontracted == 'Yes'", "fieldname": "include_exploded_items", "fieldtype": "Check", @@ -739,6 +746,7 @@ }, { "allow_on_submit": 1, + "default": "0", "fieldname": "page_break", "fieldtype": "Check", "label": "Page Break", @@ -766,11 +774,19 @@ "fieldname": "material_request_item", "fieldtype": "Data", "label": "Material Request Item" + }, + { + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 1, + "label": "Expense Account", + "options": "Account", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-05-08 10:25:27.157675", + "modified": "2019-05-30 18:09:21.648599", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item",