[transaction] [fix] fix in purchase transactions
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index f0f3867..1bb64e5 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -224,8 +224,9 @@
var me = this;
if(this.frm.doc.doctype != "Purchase Invoice") {
- wn.meta.docfield_map[this.tname]["rate"] = $.extend({},
- wn.meta.docfield_map[this.tname]["purchase_rate"]);
+ // hack!
+ wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"] = $.extend({},
+ wn.meta.docfield_copy[this.tname][this.frm.doc.name]["purchase_rate"]);
}
$.each(this.frm.item_doclist, function(i, item) {
@@ -241,6 +242,7 @@
me._set_in_company_currency(item, "import_rate", "rate");
me._set_in_company_currency(item, "import_amount", "amount");
});
+
},
calculate_net_total: function() {
@@ -299,7 +301,8 @@
// except in purchase invoice, rate field is purchase_rate
// reset fieldname of rate
if(this.frm.doc.doctype != "Purchase Invoice") {
- delete wn.meta.docfield_map[this.tname]["rate"];
+ // clear hack
+ delete wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"];
$.each(this.frm.item_doclist, function(i, item) {
item.purchase_rate = item.rate;
diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py
index 5b716fc..3571215 100644
--- a/utilities/transaction_base.py
+++ b/utilities/transaction_base.py
@@ -310,7 +310,8 @@
# round it
args.conversion_rate = flt(args.conversion_rate,
- get_field_precision(meta.get_field("conversion_rate"), args))
+ get_field_precision(meta.get_field("conversion_rate"),
+ webnotes._dict({"fields": args})))
# validate price list conversion rate
if meta.get_field("price_list_currency") and args.price_list_name and \
@@ -320,6 +321,7 @@
# round it
args.plc_conversion_rate = flt(args.plc_conversion_rate,
- get_field_precision(meta.get_field("plc_conversion_rate"), args))
+ get_field_precision(meta.get_field("plc_conversion_rate"),
+ webnotes._dict({"fields": args})))
\ No newline at end of file