fix: Added gram, pound to ounce conversion (#21709)

* fix: pound, grams to Ounce converion factor added

* fix: patch date updated for UOM Conversion Factor

* fix: grams move to gram

* fix: duplicate entry of uom converion factor and patch added

* fix: typo fix

* fix: minor changes

* Update patches.txt

Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
Vishal Dhayagude 2020-05-25 14:54:19 +05:30 committed by GitHub
parent 28d1d6c91f
commit 6ff11de2f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 7 deletions

View File

@ -692,3 +692,4 @@ erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes
erpnext.patches.v12_0.update_bom_in_so_mr
execute:frappe.delete_doc("Report", "Department Analytics")
execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
erpnext.patches.v12_0.update_uom_conversion_factor

View File

@ -0,0 +1,11 @@
from __future__ import unicode_literals
import frappe, json
def execute():
from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data
frappe.reload_doc("setup", "doctype", "UOM Conversion Factor")
frappe.reload_doc("setup", "doctype", "UOM")
frappe.reload_doc("stock", "doctype", "UOM Category")
add_uom_data()

View File

@ -1571,5 +1571,19 @@
"to_uom": "Parts Per Million",
"abbr": "ppm",
"value": "10000"
},
{
"category": "Mass",
"from_uom": "Pound",
"to_uom": "Ounce",
"abbr": "oz",
"value": "16"
},
{
"category": "Mass",
"from_uom": "Gram",
"to_uom": "Ounce",
"abbr": "oz",
"value": "0.035274"
}
]

View File

@ -336,13 +336,14 @@ def add_uom_data():
"category_name": _(d.get("category"))
}).insert(ignore_permissions=True)
uom_conversion = frappe.get_doc({
"doctype": "UOM Conversion Factor",
"category": _(d.get("category")),
"from_uom": _(d.get("from_uom")),
"to_uom": _(d.get("to_uom")),
"value": d.get("value")
}).insert(ignore_permissions=True)
if not frappe.db.exists("UOM Conversion Factor", {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))}):
uom_conversion = frappe.get_doc({
"doctype": "UOM Conversion Factor",
"category": _(d.get("category")),
"from_uom": _(d.get("from_uom")),
"to_uom": _(d.get("to_uom")),
"value": d.get("value")
}).insert(ignore_permissions=True)
def add_market_segments():
records = [