mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 18:24:10 +00:00
fix: round computed conversion factors to field precision
The inverse (1 / value) and intermediate-UOM branches of get_uom_conv_factor returned raw float quotients like 0.4535922921968971, bypassing the precision the docfields now declare. Same for the client-side back-calculation from an edited stock qty. Round both to the UOM Conversion Factor value precision.
This commit is contained in:
@@ -1802,7 +1802,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
let item = frappe.get_doc(cdt, cdn);
|
||||
item.conversion_factor = 1.0;
|
||||
if (item.stock_qty) {
|
||||
item.conversion_factor = flt(item.stock_qty) / flt(item.qty);
|
||||
item.conversion_factor = flt(
|
||||
flt(item.stock_qty) / flt(item.qty),
|
||||
precision("conversion_factor", item)
|
||||
);
|
||||
}
|
||||
|
||||
refresh_field("conversion_factor", item.name, item.parentfield);
|
||||
|
||||
Reference in New Issue
Block a user