Merge pull request #6215 from rohitwaghchaure/pos_precision_issue

[Fix] Precision issue for field conversion rate in POS
This commit is contained in:
Nabin Hait 2016-08-30 09:52:55 +05:30 committed by GitHub
commit 4f71190a85
2 changed files with 5 additions and 5 deletions

View File

@ -72,7 +72,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
},
validate_conversion_rate: function() {
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, (cur_frm) ? precision("conversion_rate") : 9);
var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
this.frm.doc.name);
var company_currency = this.frm.doc.currency || this.get_company_currency();
@ -573,7 +573,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
this.frm.doc.paid_amount : this.frm.doc.base_paid_amount;
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
flt(this.frm.doc.change_amount), precision("outstanding_amount"));
flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate), precision("outstanding_amount"));
} else if(this.frm.doc.doctype == "Purchase Invoice") {
this.frm.doc.outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));

View File

@ -84,7 +84,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.payment_val = 0.0
if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
//When user first time click on row
this.payment_val = flt(this.frm.doc.outstanding_amount)
this.payment_val = flt(this.frm.doc.outstanding_amount / this.frm.doc.conversion_rate, precision("outstanding_amount"))
this.selected_mode.val(format_number(this.payment_val, 2));
this.update_payment_amount()
}else if(flt(this.selected_mode.val()) > 0){
@ -200,7 +200,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
me.change_amount(value)
} else{
if(value == 0 && update_write_off) {
value = me.frm.doc.outstanding_amount;
value = flt(me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate, precision(me.idx));
}
me.write_off_amount(value)
}
@ -227,7 +227,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
$(this.$body).find(".write_off_amount").val(format_number(this.frm.doc.write_off_amount, precision("write_off_amount")));
$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));
$(this.$body).find('.change_amount').val(format_number(this.frm.doc.change_amount, precision("change_amount")))
$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency))
$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency))
this.update_invoice();
}
})