From c5bba43cfd4db0eeeb5f385e8cfb326c87cdd081 Mon Sep 17 00:00:00 2001 From: Noah Jacob Date: Thu, 25 Nov 2021 14:07:19 +0530 Subject: [PATCH 1/2] feat: added required_date field to set date in child table --- .../request_for_quotation.js | 17 +++++++++++++++++ .../request_for_quotation.json | 9 ++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index bde00cbd94ee..6a336e4662c2 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -124,6 +124,14 @@ frappe.ui.form.on("Request for Quotation",{ dialog.show() }, + schedule_date(frm) { + if(frm.doc.schedule_date){ + frm.doc.items.forEach((item) => { + item.schedule_date = frm.doc.schedule_date; + }) + } + refresh_field("items"); + }, preview: (frm) => { let dialog = new frappe.ui.Dialog({ title: __('Preview Email'), @@ -184,7 +192,16 @@ frappe.ui.form.on("Request for Quotation",{ dialog.show(); } }) +frappe.ui.form.on("Request for Quotation Item", { + items_add(frm, cdt, cdn) { + if (frm.doc.schedule_date) { + let row = locals[cdt][cdn]; + row.schedule_date = frm.doc.schedule_date; + frm.refresh_field("items"); + } + } +}); frappe.ui.form.on("Request for Quotation Supplier",{ supplier: function(frm, cdt, cdn) { var d = locals[cdt][cdn] diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json index 4ce4100a7fc6..4993df90d16d 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json @@ -12,6 +12,7 @@ "vendor", "column_break1", "transaction_date", + "schedule_date", "status", "amended_from", "suppliers_section", @@ -246,16 +247,22 @@ "fieldname": "sec_break_email_2", "fieldtype": "Section Break", "hide_border": 1 + }, + { + "fieldname": "schedule_date", + "fieldtype": "Date", + "label": "Required Date" } ], "icon": "fa fa-shopping-cart", "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2020-11-05 22:04:29.017134", + "modified": "2021-11-24 17:47:49.909000", "modified_by": "Administrator", "module": "Buying", "name": "Request for Quotation", + "naming_rule": "By \"Naming Series\" field", "owner": "Administrator", "permissions": [ { From 35dc35e310da28a4ee4e6107e2e81802c23c117d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 14 Dec 2021 12:11:01 +0530 Subject: [PATCH 2/2] fix: dont refresh full table --- .../doctype/request_for_quotation/request_for_quotation.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index 6a336e4662c2..e7049fd5221e 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -195,11 +195,8 @@ frappe.ui.form.on("Request for Quotation",{ frappe.ui.form.on("Request for Quotation Item", { items_add(frm, cdt, cdn) { if (frm.doc.schedule_date) { - let row = locals[cdt][cdn]; - row.schedule_date = frm.doc.schedule_date; - frm.refresh_field("items"); + frappe.model.set_value(cdt, cdn, 'schedule_date', frm.doc.schedule_date); } - } }); frappe.ui.form.on("Request for Quotation Supplier",{