diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 81d2786c107..8de1a1219c8 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 c37a61739e9..9ee82d21189 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) {