call calc_adjustment_amount function only if docstatus is zero

This commit is contained in:
Nabin Hait 2013-02-12 18:49:55 +05:30
parent cd50c2513f
commit 4860754407
3 changed files with 4 additions and 2 deletions

View File

@ -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 \

View File

@ -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 ***************************

View File

@ -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);
}