Uncaught TypeError: Converting circular structure to JSON

Hi All! I bumped into this JS error after updating to the newest version. This is when I change UOM field in Stock Entry Window. Before, if the item has a UOM Conversion Detail, it will show Conversion Factor but now it is getting this error. I believe it is this script from stock_entry.js.

uom: function(doc, cdt, cdn) {
		var d = locals[cdt][cdn];
		if(d.uom && d.item_code){
			var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
			return get_server_fields('get_uom_details', JSON.stringify(arg),
				'items', doc, cdt, cdn, 1);
		}
	}, 

And this JSON.stringify(arg) I believe is the one causing the error. Any input is greatly appreciated. Thanks!

Is this still an issue or is this fixed?

Hi @rmehta . Still an Issue. I actually was tracing the code. And found out that below change is causing the error:

NEW CODE

      uom: function(doc, cdt, cdn) {
		var d = locals[cdt][cdn];
	if(d.uom && d.item_code){
		var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
		return get_server_fields('get_uom_details', JSON.stringify(arg),
			'items', doc, cdt, cdn, 1);
		}
	},

OLD CODE

cur_frm.cscript.uom = function(doc, cdt, cdn) {
	var d = locals[cdt][cdn];
	if(d.uom && d.item_code){
		var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
		return get_server_fields('get_uom_details', JSON.stringify(arg),
			'items', doc, cdt, cdn, 1);
	}
}

Tried changing the new code to old code (for this trigger only) and it went through.

Found no change in get_server_fields function.

i change that script with this code and i test this code is running on stock entry:

Hi @komsel2228 ! Thanks for this. Hope you can submit this for integration. As of now, I reverted the code for this part only for m project. Thanks!