From da941af6873da165f50a59fcaaae377fbe3bb6df Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 17 Jan 2018 16:23:04 +0530 Subject: [PATCH] Set due date in purchase invoice based on suppler invoice date (#12395) --- erpnext/controllers/accounts_controller.py | 2 +- erpnext/public/js/controllers/transaction.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 81d2786c10..8de1a1219c 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -666,7 +666,7 @@ class AccountsController(TransactionBase): self.remove(item) def set_payment_schedule(self): - posting_date = self.get("posting_date") or self.get("transaction_date") + posting_date = self.get("bill_date") or self.get("posting_date") or self.get("transaction_date") date = self.get("due_date") due_date = date or posting_date grand_total = self.get("rounded_total") or self.grand_total diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index c37a61739e..9ee82d2118 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1261,11 +1261,14 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ payment_terms_template: function() { var me = this; if(this.frm.doc.payment_terms_template) { + var posting_date = this.frm.doc.bill_date || + this.frm.doc.posting_date || this.frm.doc.transaction_date; + 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, + posting_date: posting_date, grand_total: this.frm.doc.rounded_total || this.frm.doc.grand_total }, callback: function(r) {