From 354dd9b35a0272cf93999f1396b9fd377c6ec0c7 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 2 Feb 2012 12:42:14 +0530 Subject: [PATCH] Allow changing export_rate if discount=0, then calculate discount based on ref_rate and export_rate (valid for non inclusive pricing) --- erpnext/selling/doctype/sales_common/sales_common.js | 7 +++++++ version.num | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 8876fa48f7..5039fcdc23 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -168,6 +168,13 @@ cur_frm.cscript.basic_rate = function(doc, cdt, cdn) { // ************************ EXPORT RATE ************************* cur_frm.cscript.export_rate = function(doc,cdt,cdn) { + var cur_rec = locals[cdt][cdn]; + var fname = cur_frm.cscript.fname; + var tname = cur_frm.cscript.tname; + if(flt(cur_rec.ref_rate)>0 && flt(cur_rec.export_rate)>0 && !flt(cur_rec.adj_rate)) { + var adj_rate = 100 * (1 - (flt(cur_rec.export_rate) / flt(cur_rec.ref_rate))); + set_multiple(tname, cur_rec.name, { 'adj_rate': adj_rate }, fname); + } doc = locals[doc.doctype][doc.name]; cur_frm.cscript.recalc(doc, 1); } diff --git a/version.num b/version.num index c2807f7f3c..acfba60953 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -140 \ No newline at end of file +141 \ No newline at end of file