Payment Terms: doctypes, schedule, payments and more

fix payment terms template setup:
- add_fetch to correct credit_days and credit_months not credit_days_months

fixed bug in `make_customer_gl_entry` and `make_supplier_entry:
all sales invoice were failing because they were all attempting to
make gl entry from payment schedule. Same with purchase invoices
This commit is contained in:
Nabin Hait
2017-08-15 08:23:51 +05:30
committed by tunde
parent 592e8c2e77
commit 9275969b51
30 changed files with 1436 additions and 32 deletions

View File

@@ -1100,6 +1100,46 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}
}
},
payment_terms_template: function() {
var me = this;
if(this.frm.doc.payment_terms_template) {
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.grand_total
},
callback: function(r) {
if(r.message && !r.exc) {
me.frm.set_value("payment_schedule", r.message);
}
}
})
}
},
payment_term: function(doc, cdt, cdn) {
var row = locals[cdt][cdn];
if(row.payment_term) {
frappe.call({
method: "erpnext.controllers.accounts_controller.get_payment_term_details",
args: {
term: row.payment_term,
posting_date: this.frm.doc.posting_date || this.frm.doc.transaction_date,
grand_total: this.frm.doc.grand_total
},
callback: function(r) {
if(r.message && !r.exc) {
for (var d in r.message) {
frappe.model.set_value(cdt, cdn, d, r.message[d]);
}
}
}
})
}
}
});
erpnext.show_serial_batch_selector = function(frm, d) {