diff --git a/erpnext/patches.txt b/erpnext/patches.txt index bfce3463c8a..3e4bc81a12f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -93,3 +93,4 @@ erpnext.patches.v4_2.recalculate_bom_costs erpnext.patches.v4_2.discount_amount erpnext.patches.v4_2.update_landed_cost_voucher erpnext.patches.v4_2.set_item_has_batch +erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle diff --git a/erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py b/erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py new file mode 100644 index 00000000000..4e9945ee602 --- /dev/null +++ b/erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py @@ -0,0 +1,11 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql("""update `tabStock Ledger Entry` sle, tabItem item + set sle.stock_uom = item.stock_uom + where sle.voucher_type="Delivery Note" and item.name = sle.item_code + and sle.stock_uom != item.stock_uom""") diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 58a4412852a..b5de2554f98 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -52,7 +52,7 @@ class StockLedgerEntry(Document): frappe.throw(_("Actual Qty is mandatory")) def validate_item(self): - item_det = frappe.db.sql("""select name, has_batch_no, docstatus, is_stock_item + item_det = frappe.db.sql("""select name, has_batch_no, docstatus, is_stock_item, stock_uom from tabItem where name=%s""", self.item_code, as_dict=True)[0] if item_det.is_stock_item != 'Yes':