From 8f44d1c63dfb3f1a75dc85d18ca0734ecb36a45e Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Fri, 5 Jan 2018 08:16:50 +0100 Subject: [PATCH] Payment Terms in Delivery Note #12167 (#12293) * add Payment Terms Template field to delivery note: - This helps for users who create invoice from Sales Invoice - Field is hidden in print - Field is not coupled to Payment Schedule table. * do nothing in payment_terms_template trigger if doctype is Delivery Note --- erpnext/public/js/controllers/transaction.js | 9 +- .../doctype/delivery_note/delivery_note.json | 91 ++++++++++++++++++- 2 files changed, 95 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 711e836f3a..0b0bf8e582 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1231,13 +1231,14 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ payment_terms_template: function() { var me = this; - if(this.frm.doc.payment_terms_template) { + const doc = this.frm.doc; + if(doc.payment_terms_template && doc.doctype !== 'Delivery Note') { frappe.call({ method: "erpnext.controllers.accounts_controller.get_payment_terms", args: { - terms_template: this.frm.doc.payment_terms_template, - posting_date: this.frm.doc.posting_date || this.frm.doc.transaction_date, - grand_total: this.frm.doc.rounded_total || this.frm.doc.grand_total + terms_template: doc.payment_terms_template, + posting_date: doc.posting_date || doc.transaction_date, + grand_total: doc.rounded_total || doc.grand_total }, callback: function(r) { if(r.message && !r.exc) { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 1f944e46f4..0e6bf16915 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -2433,6 +2433,95 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_terms_template_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_terms_template", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payment Terms Template", + "length": 0, + "no_copy": 0, + "options": "Payment Terms Template", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "terms_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -3641,7 +3730,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-29 14:13:32.770027", + "modified": "2018-01-02 09:24:54.746875", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note",