Merge pull request #57884 from frappe/mergify/bp/version-16-hotfix/pr-57873

fix: declare precision 9 on all conversion_factor fields (backport #57873)
This commit is contained in:
Mihir Kandoi
2026-08-07 23:00:15 +05:30
committed by GitHub
30 changed files with 67 additions and 36 deletions

View File

@@ -238,6 +238,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"reqd": 1
},
@@ -858,7 +859,7 @@
],
"istable": 1,
"links": [],
"modified": "2026-04-20 16:16:12.322024",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice Item",

View File

@@ -237,6 +237,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -1017,7 +1018,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-05-06 08:08:40.782395",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@@ -228,6 +228,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"reqd": 1
},
@@ -1036,7 +1037,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-06-03 13:17:36.145788",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@@ -260,6 +260,7 @@
"label": "UOM Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Currency",
"precision": "9",
"print_hide": 1,
"print_width": "100px",
"reqd": 1,
@@ -953,7 +954,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-07-15 10:30:04.600510",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",

View File

@@ -132,6 +132,7 @@
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Currency",
"precision": "9",
"read_only": 1
},
{
@@ -207,7 +208,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2024-03-27 13:10:26.235916",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Receipt Item Supplied",

View File

@@ -239,6 +239,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -261,7 +262,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-01-31 19:46:27.884592",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Buying",
"name": "Request for Quotation Item",

View File

@@ -217,6 +217,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -614,7 +615,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-07-15 10:33:24.855979",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@@ -140,7 +140,8 @@
{
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor"
"label": "Conversion Factor",
"precision": "9"
},
{
"fetch_from": "item_code.stock_uom",
@@ -264,7 +265,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-11-05 21:15:55.187671",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Creator Item",

View File

@@ -177,7 +177,8 @@
{
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor"
"label": "Conversion Factor",
"precision": "9"
},
{
"fieldname": "rate_amount_section",
@@ -327,7 +328,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-11-05 19:00:38.646539",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Item",

View File

@@ -99,6 +99,7 @@
"fieldtype": "Float",
"label": "Conversion Factor",
"non_negative": 1,
"precision": "9",
"reqd": 1
},
{
@@ -217,7 +218,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-06-16 16:49:19.000000",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Secondary Item",

View File

@@ -193,6 +193,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -266,7 +267,7 @@
"grid_page_length": 50,
"istable": 1,
"links": [],
"modified": "2025-10-30 17:01:25.996352",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Material Request Plan Item",

View File

@@ -1771,7 +1771,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);

View File

@@ -38,6 +38,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -106,7 +107,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-08-21 18:11:30.134073",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Selling",
"name": "Delivery Schedule Item",

View File

@@ -198,6 +198,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -711,7 +712,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-01-30 12:56:08.320190",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",

View File

@@ -251,6 +251,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -1035,7 +1036,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-02-22 16:40:00.200328",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",

View File

@@ -236,6 +236,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"read_only": 1,
"reqd": 1
@@ -952,7 +953,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-04-07 15:43:20.892151",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@@ -1453,7 +1453,7 @@ def get_item_details(item_code, company=None):
@frappe.whitelist()
def get_uom_conv_factor(uom, stock_uom):
def get_uom_conv_factor(uom: str | None, stock_uom: str | None):
"""Get UOM conversion factor from uom to stock_uom
e.g. uom = "Kg", stock_uom = "Gram" then returns 1000.0
"""
@@ -1472,7 +1472,7 @@ def get_uom_conv_factor(uom, stock_uom):
"UOM Conversion Factor", {"to_uom": from_uom, "from_uom": to_uom}, ["value"], as_dict=1
)
if inverse_match:
return 1 / inverse_match.value
return flt(1 / inverse_match.value, frappe.get_precision("UOM Conversion Factor", "value"))
# This attempts to try and get conversion from intermediate UOM.
# case:
@@ -1495,7 +1495,7 @@ def get_uom_conv_factor(uom, stock_uom):
)
if intermediate_match:
return intermediate_match[0].value
return flt(intermediate_match[0].value, frappe.get_precision("UOM Conversion Factor", "value"))
@frappe.whitelist()

View File

@@ -159,6 +159,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"print_hide": 1,
"reqd": 1
},
@@ -545,7 +546,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-01-06 20:47:27.317226",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request Item",

View File

@@ -228,7 +228,8 @@
{
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor"
"label": "Conversion Factor",
"precision": "9"
},
{
"fieldname": "rate",
@@ -315,7 +316,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-04-27 14:12:53.236906",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packed Item",

View File

@@ -124,6 +124,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -296,7 +297,7 @@
],
"istable": 1,
"links": [],
"modified": "2026-07-06 18:17:18.000000",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Pick List Item",

View File

@@ -290,6 +290,7 @@
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Currency",
"precision": "9",
"print_hide": 1,
"print_width": "100px",
"reqd": 1,
@@ -1149,7 +1150,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-04-29 16:01:34.154697",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@@ -106,12 +106,13 @@
"fieldtype": "Float",
"label": "Conversion Factor",
"no_copy": 1,
"precision": "9",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-07-08 09:19:26.711470",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Putaway Rule",

View File

@@ -255,6 +255,7 @@
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Currency",
"precision": "9",
"print_hide": 1,
"reqd": 1
},
@@ -689,7 +690,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-07-06 18:17:18.000000",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@@ -28,7 +28,8 @@
"label": "Conversion Factor",
"non_negative": 1,
"oldfieldname": "conversion_factor",
"oldfieldtype": "Float"
"oldfieldtype": "Float",
"precision": "9"
},
{
"fieldname": "column_break_nmeg",
@@ -38,7 +39,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-06-11 23:02:54.800673",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Stock",
"name": "UOM Conversion Detail",

View File

@@ -107,6 +107,7 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -128,7 +129,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-03-27 13:10:45.904619",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting BOM",

View File

@@ -87,6 +87,7 @@
"fieldtype": "Float",
"hidden": 1,
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -186,7 +187,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-10-18 18:04:04.204651",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Inward Order Item",

View File

@@ -174,6 +174,7 @@
"fieldtype": "Float",
"hidden": 1,
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -425,7 +426,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2026-02-27 23:03:36.436504",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order Item",

View File

@@ -63,6 +63,7 @@
"fieldtype": "Float",
"hidden": 1,
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -176,7 +177,7 @@
"hide_toolbar": 1,
"istable": 1,
"links": [],
"modified": "2025-10-30 16:00:43.379828",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order Supplied Item",

View File

@@ -201,6 +201,7 @@
"fieldtype": "Float",
"hidden": 1,
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -635,7 +636,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2026-03-09 15:11:16.977539",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Item",

View File

@@ -132,6 +132,7 @@
"fieldtype": "Float",
"hidden": 1,
"label": "Conversion Factor",
"precision": "9",
"read_only": 1
},
{
@@ -264,7 +265,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2025-05-27 12:33:58.772638",
"modified": "2026-08-07 17:31:31.732720",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Supplied Item",