diff --git a/babel_extractors.csv b/babel_extractors.csv new file mode 100644 index 000000000000..a8ae8a776035 --- /dev/null +++ b/babel_extractors.csv @@ -0,0 +1 @@ +**/setup/setup_wizard/data/uom_data.json,erpnext.gettext.extractors.uom_data.extract diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py index acd993376a76..e71d322084ee 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py @@ -172,7 +172,7 @@ def get_item_dict(): income_expense_account_field = ( "income_account" if row.party_type == "Customer" else "expense_account" ) - default_uom = frappe.db.get_single_value("Stock Settings", "stock_uom") or _("Nos") + default_uom = frappe.db.get_single_value("Stock Settings", "stock_uom") or "Nos" rate = flt(row.outstanding_amount) / flt(row.qty) item_dict = frappe._dict( diff --git a/erpnext/gettext/__init__.py b/erpnext/gettext/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/erpnext/gettext/extractors/__init__.py b/erpnext/gettext/extractors/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/erpnext/gettext/extractors/uom_data.py b/erpnext/gettext/extractors/uom_data.py new file mode 100644 index 000000000000..d279c92952c4 --- /dev/null +++ b/erpnext/gettext/extractors/uom_data.py @@ -0,0 +1,17 @@ +import json + + +def extract(fileobj, *args, **kwargs): + """ + Extract messages from a JSON file with standard UOM data. To be used by the Babel extractor. + + :param fileobj: the file-like object the messages should be extracted from + :rtype: `iterator` + """ + uom_list = json.load(fileobj) + + if not isinstance(uom_list, list): + return + + for uom_data in uom_list: + yield None, "_", uom_data.get("uom_name"), ["Name of a UOM"] diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index f5b2e2d96b88..9106d09c2758 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -159,7 +159,7 @@ def get_invoice_summary(items, taxes): rate=reference_row.tax_amount, qty=1.0, amount=reference_row.tax_amount, - stock_uom=frappe.db.get_single_value("Stock Settings", "stock_uom") or _("Nos"), + stock_uom=frappe.db.get_single_value("Stock Settings", "stock_uom") or "Nos", tax_rate=tax.rate, tax_amount=(reference_row.tax_amount * tax.rate) / 100, net_amount=reference_row.tax_amount, diff --git a/erpnext/setup/doctype/uom/uom.json b/erpnext/setup/doctype/uom/uom.json index afd23120793c..35d7cf38f926 100644 --- a/erpnext/setup/doctype/uom/uom.json +++ b/erpnext/setup/doctype/uom/uom.json @@ -65,7 +65,7 @@ "icon": "fa fa-compass", "idx": 1, "links": [], - "modified": "2024-03-21 14:46:48.422406", + "modified": "2024-03-25 22:59:03.975975", "modified_by": "Administrator", "module": "Setup", "name": "UOM", @@ -104,5 +104,6 @@ "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "ASC", - "states": [] + "states": [], + "translated_doctype": 1 } \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/data/uom_data.json b/erpnext/setup/setup_wizard/data/uom_data.json index e7f2f84343c2..12f11ce5b85f 100644 --- a/erpnext/setup/setup_wizard/data/uom_data.json +++ b/erpnext/setup/setup_wizard/data/uom_data.json @@ -1,251 +1,249 @@ [ { - "uom_name": "Unit", - "must_be_whole_number": 1 - }, - { - "uom_name": "Box", - "must_be_whole_number": 1 - }, { - "uom_name": "Nos", - "must_be_whole_number": 1 - }, { - "uom_name": "Pair", - "must_be_whole_number": 1 - }, { - "uom_name": "Set", - "must_be_whole_number": 1 - }, - { - "uom_name": "Meter", + "uom_name": "Abampere", "must_be_whole_number": 0 }, { - "uom_name": "Barleycorn", + "uom_name": "Acre", "must_be_whole_number": 0 }, { - "uom_name": "Calibre", + "uom_name": "Acre (US)", "must_be_whole_number": 0 }, { - "uom_name": "Cable Length (UK)", + "uom_name": "Ampere", "must_be_whole_number": 0 }, { - "uom_name": "Cable Length (US)", + "uom_name": "Ampere-Hour", "must_be_whole_number": 0 }, { - "uom_name": "Cable Length", + "uom_name": "Ampere-Minute", "must_be_whole_number": 0 }, { - "uom_name": "Centimeter", + "uom_name": "Ampere-Second", "must_be_whole_number": 0 }, { - "uom_name": "Chain", + "uom_name": "Are", "must_be_whole_number": 0 }, { - "uom_name": "Decimeter", + "uom_name": "Area", "must_be_whole_number": 0 }, { - "uom_name": "Ells (UK)", + "uom_name": "Arshin", "must_be_whole_number": 0 }, { - "uom_name": "Ems(Pica)", + "uom_name": "Atmosphere", "must_be_whole_number": 0 }, { - "uom_name": "Fathom", + "uom_name": "Bar", "must_be_whole_number": 0 }, { - "uom_name": "Foot", + "uom_name": "Barleycorn", "must_be_whole_number": 0 }, { - "uom_name": "Furlong", + "uom_name": "Barrel (Oil)", "must_be_whole_number": 0 }, { - "uom_name": "Hand", + "uom_name": "Barrel(Beer)", "must_be_whole_number": 0 }, { - "uom_name": "Hectometer", + "uom_name": "Biot", "must_be_whole_number": 0 }, { - "uom_name": "Inch", - "must_be_whole_number": 0 + "uom_name": "Box", + "must_be_whole_number": 1, + "common_code": "BX" }, { - "uom_name": "Kilometer", + "uom_name": "Btu (It)", "must_be_whole_number": 0 }, { - "uom_name": "Link", + "uom_name": "Btu (Mean)", "must_be_whole_number": 0 }, { - "uom_name": "Micrometer", + "uom_name": "Btu (Th)", "must_be_whole_number": 0 }, { - "uom_name": "Mile", + "uom_name": "Btu/Hour", "must_be_whole_number": 0 }, { - "uom_name": "Mile (Nautical)", + "uom_name": "Btu/Minutes", "must_be_whole_number": 0 }, { - "uom_name": "Millimeter", + "uom_name": "Btu/Seconds", "must_be_whole_number": 0 }, { - "uom_name": "Nanometer", + "uom_name": "Bushel (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Rod", + "uom_name": "Bushel (US Dry Level)", "must_be_whole_number": 0 }, { - "uom_name": "Vara", + "uom_name": "Caballeria", "must_be_whole_number": 0 }, { - "uom_name": "Versta", + "uom_name": "Cable Length", "must_be_whole_number": 0 }, { - "uom_name": "Yard", + "uom_name": "Cable Length (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Arshin", + "uom_name": "Cable Length (US)", "must_be_whole_number": 0 }, { - "uom_name": "Sazhen", + "uom_name": "Calibre", "must_be_whole_number": 0 }, { - "uom_name": "Medio Metro", + "uom_name": "Calorie (Food)", "must_be_whole_number": 0 }, { - "uom_name": "Square Meter", + "uom_name": "Calorie (It)", "must_be_whole_number": 0 }, { - "uom_name": "Centiarea", + "uom_name": "Calorie (Mean)", "must_be_whole_number": 0 }, { - "uom_name": "Area", + "uom_name": "Calorie (Th)", "must_be_whole_number": 0 }, { - "uom_name": "Manzana", + "uom_name": "Calorie/Seconds", "must_be_whole_number": 0 }, { - "uom_name": "Caballeria", + "uom_name": "Carat", "must_be_whole_number": 0 }, { - "uom_name": "Square Kilometer", + "uom_name": "Celsius", "must_be_whole_number": 0 }, { - "uom_name": "Are", + "uom_name": "Cental", "must_be_whole_number": 0 }, { - "uom_name": "Acre", + "uom_name": "Centiarea", "must_be_whole_number": 0 }, { - "uom_name": "Acre (US)", + "uom_name": "Centigram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Hectare", + "uom_name": "Centilitre", "must_be_whole_number": 0 }, { - "uom_name": "Square Yard", - "must_be_whole_number": 0 + "uom_name": "Centimeter", + "must_be_whole_number": 0, + "common_code": "CMT", + "symbol": "cm" }, { - "uom_name": "Square Foot", - "must_be_whole_number": 0 + "uom_name": "Chain", + "must_be_whole_number": 0, + "common_code": "M49", + "symbol": "ch (US survey)" }, { - "uom_name": "Square Inch", + "uom_name": "Coulomb", "must_be_whole_number": 0 }, { - "uom_name": "Square Centimeter", + "uom_name": "Cubic Centimeter", "must_be_whole_number": 0 }, { - "uom_name": "Square Mile", + "uom_name": "Cubic Decimeter", "must_be_whole_number": 0 }, { - "uom_name": "Meter/Second", - "must_be_whole_number": 0 + "uom_name": "Cubic Foot", + "must_be_whole_number": 0, + "common_code": "FTQ", + "symbol": "ft³" }, { - "uom_name": "Inch/Minute", - "must_be_whole_number": 0 + "uom_name": "Cubic Inch", + "must_be_whole_number": 0, + "common_code": "INQ", + "symbol": "in³" }, { - "uom_name": "Foot/Minute", - "must_be_whole_number": 0 + "uom_name": "Cubic Meter", + "must_be_whole_number": 0, + "common_code": "MTQ", + "symbol": "m³" }, { - "uom_name": "Inch/Second", + "uom_name": "Cubic Millimeter", "must_be_whole_number": 0 }, { - "uom_name": "Kilometer/Hour", + "uom_name": "Cubic Yard", "must_be_whole_number": 0 }, { - "uom_name": "Foot/Second", + "uom_name": "Cup", "must_be_whole_number": 0 }, { - "uom_name": "Mile/Hour", + "uom_name": "Cycle/Second", "must_be_whole_number": 0 }, { - "uom_name": "Knot", - "must_be_whole_number": 0 + "uom_name": "Day", + "must_be_whole_number": 0, + "common_code": "DAY", + "symbol": "d" }, { - "uom_name": "Mile/Minute", + "uom_name": "Decigram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Mile/Second", + "uom_name": "Decilitre", "must_be_whole_number": 0 }, { - "uom_name": "Carat", - "must_be_whole_number": 0 + "uom_name": "Decimeter", + "must_be_whole_number": 0, + "common_code": "DMT", + "symbol": "dm" }, { - "uom_name": "Cental", + "uom_name": "Dekagram/Litre", "must_be_whole_number": 0 }, { @@ -253,535 +251,599 @@ "must_be_whole_number": 0 }, { - "uom_name": "Grain", + "uom_name": "Dyne", "must_be_whole_number": 0 }, { - "uom_name": "Gram", + "uom_name": "EMU Of Charge", "must_be_whole_number": 0 }, { - "uom_name": "Hundredweight (UK)", + "uom_name": "EMU of current", "must_be_whole_number": 0 }, { - "uom_name": "Hundredweight (US)", + "uom_name": "Ells (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Quintal", + "uom_name": "Ems(Pica)", "must_be_whole_number": 0 }, { - "uom_name": "Kg", + "uom_name": "Erg", "must_be_whole_number": 0 }, { - "uom_name": "Microgram", + "uom_name": "Fahrenheit", "must_be_whole_number": 0 }, { - "uom_name": "Milligram", + "uom_name": "Faraday", "must_be_whole_number": 0 }, { - "uom_name": "Ounce", + "uom_name": "Fathom", "must_be_whole_number": 0 }, { - "uom_name": "Pood", + "uom_name": "Fluid Ounce (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Pound", + "uom_name": "Fluid Ounce (US)", "must_be_whole_number": 0 }, { - "uom_name": "Slug", - "must_be_whole_number": 0 + "uom_name": "Foot", + "must_be_whole_number": 0, + "common_code": "FOT", + "symbol": "ft" }, { - "uom_name": "Stone", + "uom_name": "Foot Of Water", "must_be_whole_number": 0 }, { - "uom_name": "Tonne", + "uom_name": "Foot/Minute", "must_be_whole_number": 0 }, { - "uom_name": "Kip", + "uom_name": "Foot/Second", "must_be_whole_number": 0 }, { - "uom_name": "Barrel(Beer)", - "must_be_whole_number": 0 + "uom_name": "Furlong", + "must_be_whole_number": 0, + "common_code": "M50", + "symbol": "fur" }, { - "uom_name": "Barrel (Oil)", + "uom_name": "Gallon (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Bushel (UK)", + "uom_name": "Gallon Dry (US)", "must_be_whole_number": 0 }, { - "uom_name": "Bushel (US Dry Level)", + "uom_name": "Gallon Liquid (US)", "must_be_whole_number": 0 }, { - "uom_name": "Centilitre", + "uom_name": "Gamma", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Centimeter", + "uom_name": "Gauss", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Decimeter", + "uom_name": "Grain", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Foot", + "uom_name": "Grain/Cubic Foot", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Inch", + "uom_name": "Grain/Gallon (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Meter", + "uom_name": "Grain/Gallon (US)", "must_be_whole_number": 0 }, { - "uom_name": "Cubic Millimeter", - "must_be_whole_number": 0 + "uom_name": "Gram", + "must_be_whole_number": 0, + "common_code": "GRM", + "symbol": "g" }, { - "uom_name": "Cubic Yard", + "uom_name": "Gram-Force", "must_be_whole_number": 0 }, { - "uom_name": "Cup", + "uom_name": "Gram/Cubic Centimeter", "must_be_whole_number": 0 }, { - "uom_name": "Decilitre", - "must_be_whole_number": 0 + "uom_name": "Gram/Cubic Meter", + "must_be_whole_number": 0, + "common_code": "A93", + "symbol": "g/m³" }, { - "uom_name": "Fluid Ounce (UK)", + "uom_name": "Gram/Cubic Millimeter", "must_be_whole_number": 0 }, { - "uom_name": "Fluid Ounce (US)", - "must_be_whole_number": 0 + "uom_name": "Gram/Litre", + "must_be_whole_number": 0, + "common_code": "GL", + "symbol": "g/l" }, { - "uom_name": "Gallon (UK)", + "uom_name": "Hand", "must_be_whole_number": 0 }, { - "uom_name": "Gallon Dry (US)", + "uom_name": "Hectare", "must_be_whole_number": 0 }, { - "uom_name": "Gallon Liquid (US)", + "uom_name": "Hectogram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Litre", + "uom_name": "Hectometer", "must_be_whole_number": 0 }, { - "uom_name": "Millilitre", + "uom_name": "Hectopascal", "must_be_whole_number": 0 }, { - "uom_name": "Peck", + "uom_name": "Hertz", "must_be_whole_number": 0 }, { - "uom_name": "Pint (UK)", + "uom_name": "Horsepower", "must_be_whole_number": 0 }, { - "uom_name": "Pint, Dry (US)", + "uom_name": "Horsepower-Hours", "must_be_whole_number": 0 }, { - "uom_name": "Pint, Liquid (US)", - "must_be_whole_number": 0 + "uom_name": "Hour", + "must_be_whole_number": 0, + "common_code": "HUR" }, { - "uom_name": "Quart (UK)", + "uom_name": "Hundredweight (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Quart Dry (US)", + "uom_name": "Hundredweight (US)", "must_be_whole_number": 0 }, { - "uom_name": "Quart Liquid (US)", + "uom_name": "Iches Of Water", "must_be_whole_number": 0 }, { - "uom_name": "Tablespoon (US)", + "uom_name": "Inch", "must_be_whole_number": 0 }, { - "uom_name": "Teaspoon", + "uom_name": "Inch Pound-Force", "must_be_whole_number": 0 }, { - "uom_name": "Day", + "uom_name": "Inch/Minute", "must_be_whole_number": 0 }, { - "uom_name": "Hour", + "uom_name": "Inch/Second", "must_be_whole_number": 0 }, { - "uom_name": "Minute", + "uom_name": "Inches Of Mercury", "must_be_whole_number": 0 }, { - "uom_name": "Second", + "uom_name": "Joule", "must_be_whole_number": 0 }, { - "uom_name": "Millisecond", + "uom_name": "Joule/Meter", "must_be_whole_number": 0 }, { - "uom_name": "Microsecond", + "uom_name": "Kelvin", "must_be_whole_number": 0 }, { - "uom_name": "Nanosecond", + "uom_name": "Kg", "must_be_whole_number": 0 }, { - "uom_name": "Week", + "uom_name": "Kiloampere", "must_be_whole_number": 0 }, { - "uom_name": "Atmosphere", + "uom_name": "Kilocalorie", "must_be_whole_number": 0 }, { - "uom_name": "Pascal", + "uom_name": "Kilocoulomb", "must_be_whole_number": 0 }, { - "uom_name": "Bar", + "uom_name": "Kilogram-Force", "must_be_whole_number": 0 }, { - "uom_name": "Foot Of Water", + "uom_name": "Kilogram/Cubic Centimeter", "must_be_whole_number": 0 }, { - "uom_name": "Hectopascal", + "uom_name": "Kilogram/Cubic Meter", "must_be_whole_number": 0 }, { - "uom_name": "Iches Of Water", + "uom_name": "Kilogram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Inches Of Mercury", + "uom_name": "Kilohertz", "must_be_whole_number": 0 }, { - "uom_name": "Kilopascal", + "uom_name": "Kilojoule", "must_be_whole_number": 0 }, { - "uom_name": "Meter Of Water", - "must_be_whole_number": 0 + "uom_name": "Kilometer", + "must_be_whole_number": 0, + "common_code": "KMT", + "symbol": "km" }, { - "uom_name": "Microbar", - "must_be_whole_number": 0 + "uom_name": "Kilometer/Hour", + "must_be_whole_number": 0, + "common_code": "KMH", + "symbol": "km/h" }, { - "uom_name": "Milibar", + "uom_name": "Kilopascal", "must_be_whole_number": 0 }, { - "uom_name": "Millimeter Of Mercury", + "uom_name": "Kilopond", "must_be_whole_number": 0 }, { - "uom_name": "Millimeter Of Water", + "uom_name": "Kilopound-Force", "must_be_whole_number": 0 }, { - "uom_name": "Technical Atmosphere", + "uom_name": "Kilowatt", "must_be_whole_number": 0 }, { - "uom_name": "Torr", + "uom_name": "Kilowatt-Hour", "must_be_whole_number": 0 }, { - "uom_name": "Dyne", + "uom_name": "Kip", "must_be_whole_number": 0 }, { - "uom_name": "Gram-Force", + "uom_name": "Knot", "must_be_whole_number": 0 }, { - "uom_name": "Joule/Meter", + "uom_name": "Link", "must_be_whole_number": 0 }, { - "uom_name": "Kilogram-Force", - "must_be_whole_number": 0 + "uom_name": "Litre", + "must_be_whole_number": 0, + "common_code": "LTR", + "symbol": "l" }, { - "uom_name": "Kilopond", + "uom_name": "Litre-Atmosphere", "must_be_whole_number": 0 }, { - "uom_name": "Kilopound-Force", + "uom_name": "Megacoulomb", "must_be_whole_number": 0 }, { - "uom_name": "Newton", + "uom_name": "Megagram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Ounce-Force", + "uom_name": "Megahertz", "must_be_whole_number": 0 }, { - "uom_name": "Pond", - "must_be_whole_number": 0 + "uom_name": "Megajoule", + "must_be_whole_number": 0, + "common_code": "3B", + "symbol": "MJ" }, { - "uom_name": "Pound-Force", + "uom_name": "Megawatt", "must_be_whole_number": 0 }, { - "uom_name": "Poundal", - "must_be_whole_number": 0 + "uom_name": "Meter", + "must_be_whole_number": 0, + "common_code": "MTR" }, { - "uom_name": "Tonne-Force(Metric)", + "uom_name": "Meter Of Water", "must_be_whole_number": 0 }, { - "uom_name": "Ton-Force (UK)", - "must_be_whole_number": 0 + "uom_name": "Meter/Second", + "must_be_whole_number": 0, + "common_code": "MTS", + "symbol": "m/s" }, { - "uom_name": "Ton-Force (US)", - "must_be_whole_number": 0 + "uom_name": "Microbar", + "must_be_whole_number": 0, + "common_code": "B85", + "symbol": "µbar" }, { - "uom_name": "Btu (It)", - "must_be_whole_number": 0 + "uom_name": "Microgram", + "must_be_whole_number": 0, + "common_code": "MC", + "symbol": "µg" }, { - "uom_name": "Btu (Th)", - "must_be_whole_number": 0 + "uom_name": "Microgram/Litre", + "must_be_whole_number": 0, + "common_code": "H29", + "symbol": "µg/l" }, { - "uom_name": "Btu (Mean)", - "must_be_whole_number": 0 + "uom_name": "Micrometer", + "must_be_whole_number": 0, + "common_code": "4H", + "symbol": "µm" }, { - "uom_name": "Calorie (It)", - "must_be_whole_number": 0 + "uom_name": "Microsecond", + "must_be_whole_number": 0, + "common_code": "B98", + "symbol": "µs" }, { - "uom_name": "Calorie (Th)", - "must_be_whole_number": 0 + "uom_name": "Mile", + "must_be_whole_number": 0, + "common_code": "SMI", + "symbol": "mile" }, { - "uom_name": "Calorie (Mean)", - "must_be_whole_number": 0 + "uom_name": "Mile (Nautical)", + "must_be_whole_number": 0, + "common_code": "NMI", + "symbol": "n mile" }, { - "uom_name": "Calorie (Food)", - "must_be_whole_number": 0 + "uom_name": "Mile/Hour", + "must_be_whole_number": 0, + "common_code": "HM", + "symbol": "mile/h" }, { - "uom_name": "Erg", - "must_be_whole_number": 0 + "uom_name": "Mile/Minute", + "must_be_whole_number": 0, + "common_code": "M57", + "symbol": "mi/min" }, { - "uom_name": "Horsepower-Hours", - "must_be_whole_number": 0 + "uom_name": "Mile/Second", + "must_be_whole_number": 0, + "common_code": "M58", + "symbol": "mi/s" }, { - "uom_name": "Inch Pound-Force", - "must_be_whole_number": 0 + "uom_name": "Milibar", + "must_be_whole_number": 0, + "common_code": "MBR", + "symbol": "mbar" }, { - "uom_name": "Joule", + "uom_name": "Milliampere", "must_be_whole_number": 0 }, { - "uom_name": "Kilojoule", + "uom_name": "Millicoulomb", "must_be_whole_number": 0 }, { - "uom_name": "Kilocalorie", + "uom_name": "Milligram", "must_be_whole_number": 0 }, { - "uom_name": "Kilowatt-Hour", + "uom_name": "Milligram/Cubic Centimeter", "must_be_whole_number": 0 }, { - "uom_name": "Litre-Atmosphere", + "uom_name": "Milligram/Cubic Meter", "must_be_whole_number": 0 }, { - "uom_name": "Megajoule", + "uom_name": "Milligram/Cubic Millimeter", "must_be_whole_number": 0 }, { - "uom_name": "Watt-Hour", + "uom_name": "Milligram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Btu/Hour", + "uom_name": "Millihertz", "must_be_whole_number": 0 }, { - "uom_name": "Btu/Minutes", - "must_be_whole_number": 0 + "uom_name": "Millilitre", + "must_be_whole_number": 0, + "common_code": "MLT", + "symbol": "ml" }, { - "uom_name": "Btu/Seconds", + "uom_name": "Millimeter", "must_be_whole_number": 0 }, { - "uom_name": "Calorie/Seconds", + "uom_name": "Millimeter Of Mercury", "must_be_whole_number": 0 }, { - "uom_name": "Horsepower", + "uom_name": "Millimeter Of Water", "must_be_whole_number": 0 }, { - "uom_name": "Kilowatt", + "uom_name": "Millisecond", "must_be_whole_number": 0 }, { - "uom_name": "Megawatt", - "must_be_whole_number": 0 + "uom_name": "Minute", + "must_be_whole_number": 0, + "common_code": "MIN" }, { - "uom_name": "Volt-Ampere", + "uom_name": "Nanocoulomb", "must_be_whole_number": 0 }, { - "uom_name": "Watt", + "uom_name": "Nanogram/Litre", "must_be_whole_number": 0 }, { - "uom_name": "Centigram/Litre", + "uom_name": "Nanohertz", "must_be_whole_number": 0 }, { - "uom_name": "Decigram/Litre", + "uom_name": "Nanometer", "must_be_whole_number": 0 }, { - "uom_name": "Dekagram/Litre", + "uom_name": "Nanosecond", "must_be_whole_number": 0 }, { - "uom_name": "Hectogram/Litre", + "uom_name": "Newton", "must_be_whole_number": 0 }, { - "uom_name": "Gram/Cubic Meter", - "must_be_whole_number": 0 + "uom_name": "Nos", + "must_be_whole_number": 1, + "common_code": "C62" }, { - "uom_name": "Gram/Cubic Centimeter", + "uom_name": "Ounce", "must_be_whole_number": 0 }, { - "uom_name": "Gram/Cubic Millimeter", + "uom_name": "Ounce-Force", "must_be_whole_number": 0 }, { - "uom_name": "Gram/Litre", + "uom_name": "Ounce/Cubic Foot", "must_be_whole_number": 0 }, { - "uom_name": "Grain/Gallon (US)", + "uom_name": "Ounce/Cubic Inch", "must_be_whole_number": 0 }, { - "uom_name": "Grain/Gallon (UK)", + "uom_name": "Ounce/Gallon (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Grain/Cubic Foot", + "uom_name": "Ounce/Gallon (US)", "must_be_whole_number": 0 }, { - "uom_name": "Kilogram/Cubic Meter", - "must_be_whole_number": 0 + "uom_name": "Pair", + "must_be_whole_number": 1 }, { - "uom_name": "Kilogram/Cubic Centimeter", + "uom_name": "Parts Per Million", "must_be_whole_number": 0 }, { - "uom_name": "Kilogram/Litre", + "uom_name": "Pascal", "must_be_whole_number": 0 }, { - "uom_name": "Milligram/Cubic Meter", - "must_be_whole_number": 0 + "uom_name": "Peck (UK)", + "must_be_whole_number": 0, + "common_code": "L43", + "symbol": "pk (UK)" }, { - "uom_name": "Milligram/Cubic Centimeter", - "must_be_whole_number": 0 + "uom_name": "Peck (US)", + "must_be_whole_number": 0, + "common_code": "G23", + "symbol": "pk (US)" }, { - "uom_name": "Milligram/Cubic Millimeter", + "uom_name": "Percent", "must_be_whole_number": 0 }, { - "uom_name": "Megagram/Litre", - "must_be_whole_number": 0 + "uom_name": "Pint (UK)", + "must_be_whole_number": 0, + "common_code": "PTI", + "symbol": "pt (UK)" }, { - "uom_name": "Milligram/Litre", - "must_be_whole_number": 0 + "uom_name": "Pint (US)", + "must_be_whole_number": 0, + "common_code": "PT", + "symbol": "pt (US)" }, { - "uom_name": "Microgram/Litre", - "must_be_whole_number": 0 + "uom_name": "Pint, Dry (US)", + "must_be_whole_number": 0, + "common_code": "L61", + "symbol": "pt (US dry)" }, { - "uom_name": "Nanogram/Litre", + "uom_name": "Pint, Liquid (US)", "must_be_whole_number": 0 }, { - "uom_name": "Ounce/Cubic Inch", + "uom_name": "Pond", "must_be_whole_number": 0 }, { - "uom_name": "Ounce/Cubic Foot", + "uom_name": "Pood", "must_be_whole_number": 0 }, { - "uom_name": "Ounce/Gallon (US)", + "uom_name": "Pound", + "must_be_whole_number": 0, + "common_code": "LBR", + "symbol": "lb" + }, + { + "uom_name": "Pound-Force", "must_be_whole_number": 0 }, { - "uom_name": "Ounce/Gallon (UK)", + "uom_name": "Pound/Cubic Foot", "must_be_whole_number": 0 }, { @@ -789,11 +851,11 @@ "must_be_whole_number": 0 }, { - "uom_name": "Pound/Cubic Foot", + "uom_name": "Pound/Cubic Yard", "must_be_whole_number": 0 }, { - "uom_name": "Pound/Cubic Yard", + "uom_name": "Pound/Gallon (UK)", "must_be_whole_number": 0 }, { @@ -801,7 +863,7 @@ "must_be_whole_number": 0 }, { - "uom_name": "Pound/Gallon (UK)", + "uom_name": "Poundal", "must_be_whole_number": 0 }, { @@ -809,148 +871,186 @@ "must_be_whole_number": 0 }, { - "uom_name": "Slug/Cubic Foot", + "uom_name": "Quart (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Ton (Short)/Cubic Yard", + "uom_name": "Quart Dry (US)", "must_be_whole_number": 0 }, { - "uom_name": "Ton (Long)/Cubic Yard", + "uom_name": "Quart Liquid (US)", "must_be_whole_number": 0 }, { - "uom_name": "Celsius", + "uom_name": "Quintal", "must_be_whole_number": 0 }, { - "uom_name": "Fahrenheit", + "uom_name": "Rod", "must_be_whole_number": 0 }, { - "uom_name": "Kelvin", + "uom_name": "Sazhen", "must_be_whole_number": 0 }, { - "uom_name": "Cycle/Second", - "must_be_whole_number": 0 + "uom_name": "Second", + "must_be_whole_number": 0, + "common_code": "SEC" }, { - "uom_name": "Nanohertz", - "must_be_whole_number": 0 + "uom_name": "Set", + "must_be_whole_number": 1, + "common_code": "SX" }, { - "uom_name": "Millihertz", + "uom_name": "Slug", "must_be_whole_number": 0 }, { - "uom_name": "Hertz", + "uom_name": "Slug/Cubic Foot", "must_be_whole_number": 0 }, { - "uom_name": "Kilohertz", - "must_be_whole_number": 0 + "uom_name": "Square Centimeter", + "must_be_whole_number": 0, + "common_code": "CMK", + "symbol": "cm²" }, { - "uom_name": "Megahertz", - "must_be_whole_number": 0 + "uom_name": "Square Foot", + "must_be_whole_number": 0, + "common_code": "FTK", + "symbol": "ft²" }, { - "uom_name": "Wavelength In Gigametres", - "must_be_whole_number": 0 + "uom_name": "Square Inch", + "must_be_whole_number": 0, + "common_code": "INK", + "symbol": "in²" }, { - "uom_name": "Wavelength In Megametres", - "must_be_whole_number": 0 + "uom_name": "Square Kilometer", + "must_be_whole_number": 0, + "common_code": "KMK", + "symbol": "km²" }, { - "uom_name": "Wavelength In Kilometres", - "must_be_whole_number": 0 + "uom_name": "Square Meter", + "must_be_whole_number": 0, + "common_code": "MTK", + "symbol": "m²" }, { - "uom_name": "Ampere-Hour", - "must_be_whole_number": 0 + "uom_name": "Square Mile", + "must_be_whole_number": 0, + "common_code": "MIK", + "symbol": "mi²" }, { - "uom_name": "Ampere-Minute", - "must_be_whole_number": 0 + "uom_name": "Square Yard", + "must_be_whole_number": 0, + "common_code": "YDK", + "symbol": "yd²" }, { - "uom_name": "Ampere-Second", + "uom_name": "Stone", "must_be_whole_number": 0 }, { - "uom_name": "Coulomb", + "uom_name": "Tablespoon (US)", "must_be_whole_number": 0 }, { - "uom_name": "EMU Of Charge", + "uom_name": "Teaspoon", "must_be_whole_number": 0 }, { - "uom_name": "Faraday", + "uom_name": "Technical Atmosphere", "must_be_whole_number": 0 }, { - "uom_name": "Kilocoulomb", + "uom_name": "Tesla", "must_be_whole_number": 0 }, { - "uom_name": "Megacoulomb", + "uom_name": "Ton (Long)/Cubic Yard", "must_be_whole_number": 0 }, { - "uom_name": "Millicoulomb", + "uom_name": "Ton (Short)/Cubic Yard", "must_be_whole_number": 0 }, { - "uom_name": "Nanocoulomb", + "uom_name": "Ton-Force (UK)", "must_be_whole_number": 0 }, { - "uom_name": "Ampere", + "uom_name": "Ton-Force (US)", "must_be_whole_number": 0 }, { - "uom_name": "Abampere", + "uom_name": "Tonne", + "must_be_whole_number": 0, + "common_code": "TNE", + "symbol": "t" + }, + { + "uom_name": "Tonne-Force(Metric)", "must_be_whole_number": 0 }, { - "uom_name": "Biot", + "uom_name": "Torr", "must_be_whole_number": 0 }, { - "uom_name": "EMU of current", + "uom_name": "Unit", + "must_be_whole_number": 1, + "common_code": "C62" + }, + { + "uom_name": "Vara", "must_be_whole_number": 0 }, { - "uom_name": "Kiloampere", + "uom_name": "Versta", "must_be_whole_number": 0 }, { - "uom_name": "Milliampere", + "uom_name": "Volt-Ampere", "must_be_whole_number": 0 }, { - "uom_name": "Gamma", + "uom_name": "Watt", "must_be_whole_number": 0 }, { - "uom_name": "Gauss", + "uom_name": "Watt-Hour", "must_be_whole_number": 0 }, { - "uom_name": "Tesla", + "uom_name": "Wavelength In Gigametres", "must_be_whole_number": 0 }, { - "uom_name": "Percent", + "uom_name": "Wavelength In Kilometres", "must_be_whole_number": 0 }, { - "uom_name": "Parts Per Million", + "uom_name": "Wavelength In Megametres", "must_be_whole_number": 0 + }, + { + "uom_name": "Week", + "must_be_whole_number": 0, + "common_code": "WEE", + "symbol": "wk" + }, + { + "uom_name": "Yard", + "must_be_whole_number": 0, + "common_code": "YRD", + "symbol": "yd" } - -] \ No newline at end of file +] diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py index 756409bb74c7..29314a263165 100644 --- a/erpnext/setup/setup_wizard/operations/defaults_setup.py +++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py @@ -33,7 +33,7 @@ def set_default_settings(args): stock_settings.default_warehouse = frappe.db.get_value( "Warehouse", {"warehouse_name": _("Stores")} ) - stock_settings.stock_uom = _("Nos") + stock_settings.stock_uom = "Nos" stock_settings.auto_indent = 1 stock_settings.auto_insert_price_list_rate_if_missing = 1 stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1 diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 2205924e5093..8f11424630de 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -336,16 +336,10 @@ def add_uom_data(): open(frappe.get_app_path("erpnext", "setup", "setup_wizard", "data", "uom_data.json")).read() ) for d in uoms: - if not frappe.db.exists("UOM", _(d.get("uom_name"))): - frappe.get_doc( - { - "doctype": "UOM", - "uom_name": _(d.get("uom_name")), - "name": _(d.get("uom_name")), - "must_be_whole_number": d.get("must_be_whole_number"), - "enabled": 1, - } - ).db_insert() + if not frappe.db.exists("UOM", d.get("uom_name")): + doc = frappe.new_doc("UOM") + doc.update(d) + doc.save() # bootstrap uom conversion factors uom_conversions = json.loads( @@ -359,14 +353,14 @@ def add_uom_data(): if not frappe.db.exists( "UOM Conversion Factor", - {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))}, + {"from_uom": d.get("from_uom"), "to_uom": d.get("to_uom")}, ): frappe.get_doc( { "doctype": "UOM Conversion Factor", "category": _(d.get("category")), - "from_uom": _(d.get("from_uom")), - "to_uom": _(d.get("to_uom")), + "from_uom": d.get("from_uom"), + "to_uom": d.get("to_uom"), "value": d.get("value"), } ).db_insert() @@ -480,7 +474,7 @@ def update_stock_settings(): stock_settings.default_warehouse = frappe.db.get_value( "Warehouse", {"warehouse_name": _("Stores")} ) - stock_settings.stock_uom = _("Nos") + stock_settings.stock_uom = "Nos" stock_settings.auto_indent = 1 stock_settings.auto_insert_price_list_rate_if_missing = 1 stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1