Change actual charges based on exchange rate (#10619)
* Change actual charges based on exchange rate
* Update transaction.js
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 3a8ddb5..be55406 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -527,12 +527,23 @@
if(this.frm.doc.ignore_pricing_rule) {
this.calculate_taxes_and_totals();
} else if (!this.in_apply_price_list){
+ this.set_actual_charges_based_on_currency();
this.apply_price_list();
}
}
},
+ set_actual_charges_based_on_currency: function() {
+ var me = this;
+ $.each(this.frm.doc.taxes || [], function(i, d) {
+ if(d.charge_type == "Actual") {
+ frappe.model.set_value(d.doctype, d.name, "tax_amount",
+ flt(d.tax_amount) / flt(me.frm.doc.conversion_rate));
+ }
+ });
+ },
+
get_exchange_rate: function(transaction_date, from_currency, to_currency, callback) {
if (!transaction_date || !from_currency || !to_currency) return;
return frappe.call({