Advance Payment Entry adjustment against Invoice
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index ce11c8a..ad6901c 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -4,6 +4,16 @@
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
setup: function() {
this._super();
+
+ if(in_list(["Sales Invoice", "Purchase Invoice"], this.frm.doc.doctype)) {
+ this.frm.get_field('advances').grid.editable_fields = [
+ {fieldname: 'reference_name', columns: 2},
+ {fieldname: 'remarks', columns: 3},
+ {fieldname: 'advance_amount', columns: 3},
+ {fieldname: 'allocated_amount', columns: 3}
+ ];
+ }
+
frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
@@ -978,5 +988,17 @@
if(!this.item_selector) {
this.item_selector = new erpnext.ItemSelector({frm: this.frm});
}
+ },
+
+ get_advances: function() {
+ if(!this.frm.is_return) {
+ return this.frm.call({
+ method: "set_advances",
+ doc: this.frm.doc,
+ callback: function(r, rt) {
+ refresh_field("advances");
+ }
+ })
+ }
}
});
\ No newline at end of file