[minor] [fix] set stock uom in stock ledger entry through stock reconciliation
This commit is contained in:
parent
6e6ba9de14
commit
6656acff52
@ -263,4 +263,5 @@ patch_list = [
|
|||||||
"patches.september_2013.p01_update_communication",
|
"patches.september_2013.p01_update_communication",
|
||||||
"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
|
"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
|
||||||
"patches.september_2013.p02_fix_serial_no_status",
|
"patches.september_2013.p02_fix_serial_no_status",
|
||||||
|
"patches.september_2013.p03_update_stock_uom_in_sle",
|
||||||
]
|
]
|
9
patches/september_2013/p03_update_stock_uom_in_sle.py
Normal file
9
patches/september_2013/p03_update_stock_uom_in_sle.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import webnotes
|
||||||
|
def execute():
|
||||||
|
webnotes.conn.sql("""update `tabStock Ledger Entry` sle, tabItem i
|
||||||
|
set sle.stock_uom = i.stock_uom
|
||||||
|
where sle.item_code = i.name and ifnull(sle.stock_uom, '') = ''""")
|
@ -70,7 +70,6 @@ class DocType(DocListController):
|
|||||||
matched=True
|
matched=True
|
||||||
ref_uom = webnotes.conn.get_value("Stock Ledger Entry",
|
ref_uom = webnotes.conn.get_value("Stock Ledger Entry",
|
||||||
{"item_code": self.doc.name, "is_cancelled": "No"}, "stock_uom")
|
{"item_code": self.doc.name, "is_cancelled": "No"}, "stock_uom")
|
||||||
|
|
||||||
if ref_uom:
|
if ref_uom:
|
||||||
if cstr(ref_uom) != cstr(self.doc.stock_uom):
|
if cstr(ref_uom) != cstr(self.doc.stock_uom):
|
||||||
matched = False
|
matched = False
|
||||||
|
@ -72,7 +72,7 @@ class DocType(DocListController):
|
|||||||
|
|
||||||
def validate_item(self):
|
def validate_item(self):
|
||||||
item_det = webnotes.conn.sql("""select name, has_batch_no, docstatus,
|
item_det = webnotes.conn.sql("""select name, has_batch_no, docstatus,
|
||||||
is_stock_item, has_serial_no, serial_no_series
|
is_stock_item, has_serial_no, serial_no_series, stock_uom
|
||||||
from tabItem where name=%s""",
|
from tabItem where name=%s""",
|
||||||
self.doc.item_code, as_dict=True)[0]
|
self.doc.item_code, as_dict=True)[0]
|
||||||
|
|
||||||
@ -89,6 +89,9 @@ class DocType(DocListController):
|
|||||||
where item='%s' and name ='%s' and docstatus != 2""" % (self.doc.item_code, self.doc.batch_no)):
|
where item='%s' and name ='%s' and docstatus != 2""" % (self.doc.item_code, self.doc.batch_no)):
|
||||||
webnotes.throw("'%s' is not a valid Batch Number for Item '%s'" % (self.doc.batch_no, self.doc.item_code))
|
webnotes.throw("'%s' is not a valid Batch Number for Item '%s'" % (self.doc.batch_no, self.doc.item_code))
|
||||||
|
|
||||||
|
if not self.doc.stock_uom:
|
||||||
|
self.doc.stock_uom = item_det.stock_uom
|
||||||
|
|
||||||
self.validate_serial_no(item_det)
|
self.validate_serial_no(item_det)
|
||||||
|
|
||||||
def validate_serial_no(self, item_det):
|
def validate_serial_no(self, item_det):
|
||||||
|
@ -243,6 +243,7 @@ class DocType(StockController):
|
|||||||
"voucher_type": self.doc.doctype,
|
"voucher_type": self.doc.doctype,
|
||||||
"voucher_no": self.doc.name,
|
"voucher_no": self.doc.name,
|
||||||
"company": self.doc.company,
|
"company": self.doc.company,
|
||||||
|
"stock_uom": webnotes.conn.get_value("Item", row.item_code, "stock_uom"),
|
||||||
"is_cancelled": "No",
|
"is_cancelled": "No",
|
||||||
"voucher_detail_no": row.voucher_detail_no,
|
"voucher_detail_no": row.voucher_detail_no,
|
||||||
"fiscal_year": self.doc.fiscal_year,
|
"fiscal_year": self.doc.fiscal_year,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user