From 50bdaa6d1a87d055cc8242310aff75a19de3731b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 18:08:22 +0530 Subject: [PATCH 1/2] fix: Added Expense Account field to push value from PO-PR-PI --- .../purchase_receipt_item.json | 114 +++++++++++++++++- 1 file changed, 113 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 528f799aa70..03fe4e46674 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -20,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "barcode", "fieldtype": "Data", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_2", "fieldtype": "Section Break", "hidden": 0, @@ -83,6 +85,7 @@ "bold": 1, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "item_code", "fieldtype": "Link", "hidden": 0, @@ -119,6 +122,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "supplier_part_no", "fieldtype": "Data", "hidden": 1, @@ -151,6 +155,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_2", "fieldtype": "Column Break", "hidden": 0, @@ -182,6 +187,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_name", "fieldtype": "Data", "hidden": 0, @@ -215,6 +221,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_4", "fieldtype": "Section Break", "hidden": 0, @@ -247,6 +254,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -282,6 +290,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break1", "fieldtype": "Column Break", "hidden": 0, @@ -312,6 +321,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image", "fieldtype": "Attach", "hidden": 1, @@ -344,6 +354,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image_view", "fieldtype": "Image", "hidden": 0, @@ -377,6 +388,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "received_and_accepted", "fieldtype": "Section Break", "hidden": 0, @@ -408,6 +420,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "received_qty", "fieldtype": "Float", "hidden": 0, @@ -443,6 +456,7 @@ "bold": 0, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "qty", "fieldtype": "Float", "hidden": 0, @@ -478,6 +492,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_qty", "fieldtype": "Float", "hidden": 0, @@ -513,6 +528,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break2", "fieldtype": "Column Break", "hidden": 0, @@ -544,6 +560,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "uom", "fieldtype": "Link", "hidden": 0, @@ -581,6 +598,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_uom", "fieldtype": "Link", "hidden": 0, @@ -617,6 +635,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "conversion_factor", "fieldtype": "Float", "hidden": 0, @@ -654,6 +673,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "item_code.retain_sample", + "fetch_if_empty": 0, "fieldname": "retain_sample", "fieldtype": "Check", "hidden": 0, @@ -689,6 +709,7 @@ "columns": 0, "depends_on": "retain_sample", "fetch_from": "item_code.sample_quantity", + "fetch_if_empty": 0, "fieldname": "sample_quantity", "fieldtype": "Int", "hidden": 0, @@ -722,6 +743,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rate_and_amount", "fieldtype": "Section Break", "hidden": 0, @@ -753,6 +775,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -786,6 +809,7 @@ "collapsible": 0, "columns": 0, "depends_on": "price_list_rate", + "fetch_if_empty": 0, "fieldname": "discount_percentage", "fieldtype": "Percent", "hidden": 0, @@ -818,6 +842,7 @@ "collapsible": 0, "columns": 0, "depends_on": "discount_percentage", + "fetch_if_empty": 0, "fieldname": "discount_amount", "fieldtype": "Currency", "hidden": 0, @@ -851,6 +876,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break3", "fieldtype": "Column Break", "hidden": 0, @@ -881,6 +907,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -913,6 +940,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sec_break1", "fieldtype": "Section Break", "hidden": 0, @@ -943,6 +971,7 @@ "bold": 1, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "rate", "fieldtype": "Currency", "hidden": 0, @@ -979,6 +1008,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -1013,6 +1043,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break4", "fieldtype": "Column Break", "hidden": 0, @@ -1043,6 +1074,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_rate", "fieldtype": "Currency", "hidden": 0, @@ -1079,6 +1111,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_amount", "fieldtype": "Currency", "hidden": 0, @@ -1115,6 +1148,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "pricing_rule", "fieldtype": "Link", "hidden": 0, @@ -1147,6 +1181,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_29", "fieldtype": "Section Break", "hidden": 0, @@ -1178,6 +1213,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1211,6 +1247,7 @@ "bold": 0, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1244,6 +1281,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_32", "fieldtype": "Column Break", "hidden": 0, @@ -1275,6 +1313,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1308,6 +1347,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1341,6 +1381,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_weight_details", "fieldtype": "Section Break", "hidden": 0, @@ -1373,6 +1414,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_per_unit", "fieldtype": "Float", "hidden": 0, @@ -1405,6 +1447,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_weight", "fieldtype": "Float", "hidden": 0, @@ -1437,6 +1480,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_41", "fieldtype": "Column Break", "hidden": 0, @@ -1468,6 +1512,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_uom", "fieldtype": "Link", "hidden": 0, @@ -1501,6 +1546,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", "hidden": 0, @@ -1532,6 +1578,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, @@ -1568,6 +1615,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_warehouse", "fieldtype": "Link", "hidden": 0, @@ -1605,6 +1653,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:!doc.__islocal", + "fetch_if_empty": 0, "fieldname": "quality_inspection", "fieldtype": "Link", "hidden": 0, @@ -1639,6 +1688,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_40", "fieldtype": "Column Break", "hidden": 0, @@ -1670,6 +1720,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "is_fixed_asset", "fieldtype": "Check", "hidden": 1, @@ -1703,6 +1754,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_fixed_asset", + "fetch_if_empty": 0, "fieldname": "asset", "fieldtype": "Link", "hidden": 0, @@ -1737,6 +1789,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_fixed_asset", + "fetch_if_empty": 0, "fieldname": "asset_location", "fieldtype": "Link", "hidden": 0, @@ -1770,6 +1823,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "purchase_order", "fieldtype": "Link", "hidden": 0, @@ -1806,6 +1860,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, @@ -1839,6 +1894,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_qty", "fieldtype": "Float", "hidden": 0, @@ -1874,6 +1930,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_45", "fieldtype": "Section Break", "hidden": 0, @@ -1905,6 +1962,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "serial_no", "fieldtype": "Small Text", "hidden": 0, @@ -1938,6 +1996,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "batch_no", "fieldtype": "Link", "hidden": 0, @@ -1972,6 +2031,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_48", "fieldtype": "Column Break", "hidden": 0, @@ -2004,6 +2064,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_serial_no", "fieldtype": "Small Text", "hidden": 0, @@ -2035,6 +2096,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_50", "fieldtype": "Section Break", "hidden": 0, @@ -2066,6 +2128,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "project", "fieldtype": "Link", "hidden": 0, @@ -2091,6 +2154,40 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -2100,6 +2197,7 @@ "columns": 0, "default": ":Company", "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", + "fetch_if_empty": 0, "fieldname": "cost_center", "fieldtype": "Link", "hidden": 0, @@ -2132,6 +2230,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "purchase_order_item", "fieldtype": "Data", "hidden": 1, @@ -2167,6 +2266,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break5", "fieldtype": "Column Break", "hidden": 0, @@ -2197,6 +2297,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "allow_zero_valuation_rate", "fieldtype": "Check", "hidden": 0, @@ -2229,6 +2330,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "bom", "fieldtype": "Link", "hidden": 0, @@ -2263,6 +2365,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:parent.is_subcontracted == 'Yes'", + "fetch_if_empty": 0, "fieldname": "include_exploded_items", "fieldtype": "Check", "hidden": 0, @@ -2295,6 +2398,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "billed_amt", "fieldtype": "Currency", "hidden": 0, @@ -2328,6 +2432,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "landed_cost_voucher_amount", "fieldtype": "Currency", "hidden": 0, @@ -2360,6 +2465,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "brand", "fieldtype": "Link", "hidden": 1, @@ -2395,6 +2501,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "item_group", "fieldtype": "Link", "hidden": 1, @@ -2429,6 +2536,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rm_supp_cost", "fieldtype": "Currency", "hidden": 1, @@ -2465,6 +2573,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_tax_amount", "fieldtype": "Currency", "hidden": 1, @@ -2501,6 +2610,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "valuation_rate", "fieldtype": "Currency", "hidden": 1, @@ -2538,6 +2648,7 @@ "collapsible": 0, "columns": 0, "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", + "fetch_if_empty": 0, "fieldname": "item_tax_rate", "fieldtype": "Code", "hidden": 1, @@ -2571,6 +2682,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, @@ -2608,7 +2720,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 16:04:36.138776", + "modified": "2019-05-30 18:06:42.150605", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", From 8cb2c7a89cda33051c8dd705149ccfb1d53b4625 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 18:13:11 +0530 Subject: [PATCH 2/2] fix: Set query for expense account in PO and PR --- .../buying/doctype/purchase_order/purchase_order.js | 8 ++++++++ .../stock/doctype/purchase_receipt/purchase_receipt.js | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 019d0de4708..c032df32706 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 d33c23e4b17..7a073996c74 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -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() {