Skip to content

Incorrect Parsing of Large Numbers in RFQ / Supplier Quote using Portal #46928

@buff0k

Description

@buff0k

Information about bug

When the RFQ contains quantities in excess of thousands (specifically, 4 080 000 or 2 160 000 or 960 000), and it is Submitted, when the Supplier logs into the portal, the total Qtys appear to be correctly displayed, however when the supplier enters a Rate, it only calculates the qty to the digits before the first thousands Seperator, in my case, it uses spaces (i.e 4 x Rate instead of 4 080 000 x rate).

Module

buying

Version

Frappe version v15.63.0
ERPNext version v15.55.4

Installation method

None

Relevant log output / Stack trace / Full Error Message.

There is no stack output on this matter, however it appears to be related to how the js parsing is conducted in rfq.py and rfq.js
Suggest replacing parseFloat function with a parse_number function similar to (Note unable to test or make changes to codebase, this is based on a quick read of the existing ERPNext code):

parse_number(val) {
    val = (val || "").toString()
        .replace(/[^0-9.\-]/g, '')     // remove non-numeric characters except . and -
        .replace(/(?!^)\./g, '');      // remove extra dots (if any thousands separator used .)
    return parseFloat(val) || 0;
}

and

change_qty(){
		var me = this;
		$('.rfq-items').on("change", ".rfq-qty", function(){
			me.idx = parseFloat($(this).attr('data-idx'));
			me.qty = me.parse_number($(this).val());
			me.rate = me.parse_number($(repl('.rfq-rate[data-idx=%(idx)s]',{'idx': me.idx})).val());
			me.update_qty_rate();
			$(this).val(format_number(me.qty, doc.number_format, 2));
		})
	}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions