update stock uo in sle for DN

This commit is contained in:
Nabin Hait 2015-02-20 14:23:42 +05:30
parent 010657145d
commit ad3fd5166b
3 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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""")

View File

@ -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':