From 4860754407d0284ede75f3fc9f39d437f680420d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Feb 2013 18:49:55 +0530 Subject: [PATCH] call calc_adjustment_amount function only if docstatus is zero --- .../payment_to_invoice_matching_tool.js | 1 + buying/doctype/purchase_common/purchase_common.js | 2 +- selling/doctype/sales_common/sales_common.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index 022f900b05..8b35bc1028 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -33,6 +33,7 @@ cur_frm.cscript.refresh = function(doc) { } cur_frm.fields_dict.voucher_no.get_query = function(doc) { + // TO-do: check for pos, it should not come if (!doc.account) msgprint("Please select Account first"); else { return repl("select gle.voucher_no, gle.posting_date, gle.%(account_type)s \ diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index a149db56f5..3a9d89110f 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -419,7 +419,7 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { cur_frm.cscript.calc_amount(doc, 1); // calculate advances if pv - if(doc.doctype == 'Purchase Invoice') calc_total_advance(doc, cdt, cdn); + if(doc.docstatus == 0 && doc.doctype == 'Purchase Invoice') calc_total_advance(doc, cdt, cdn); } // **************** RE-CALCULATE VALUES *************************** diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 50b97a2b55..6a618c9a1a 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -891,7 +891,8 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { } cur_frm.cscript.calculate_charges (doc, cdt, cdn); - if (cur_frm.cscript.calc_adjustment_amount) cur_frm.cscript.calc_adjustment_amount(doc); + if (doc.docstatus == 0 && cur_frm.cscript.calc_adjustment_amount) + cur_frm.cscript.calc_adjustment_amount(doc); }