mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
[fix] [minor] merge conflict fixed
This commit is contained in:
@@ -29,8 +29,8 @@ class DocType(DocListController):
|
||||
|
||||
self.check_warehouse_is_set_for_stock_item()
|
||||
self.check_stock_uom_with_bin()
|
||||
self.validate_conversion_factor()
|
||||
self.add_default_uom_in_conversion_factor_table()
|
||||
self.validate_conversion_factor()
|
||||
self.validate_item_type()
|
||||
self.check_for_active_boms()
|
||||
self.fill_customer_code()
|
||||
@@ -57,15 +57,38 @@ class DocType(DocListController):
|
||||
ch = addchild(self.doc, 'uom_conversion_details', 'UOM Conversion Detail', self.doclist)
|
||||
ch.uom = self.doc.stock_uom
|
||||
ch.conversion_factor = 1
|
||||
|
||||
for d in self.doclist.get({"parentfield": "uom_conversion_details"}):
|
||||
if d.conversion_factor == 1 and d.uom != self.doc.stock_uom:
|
||||
self.doclist.remove(d)
|
||||
|
||||
|
||||
def check_stock_uom_with_bin(self):
|
||||
if not self.doc.fields.get("__islocal"):
|
||||
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
|
||||
self.doc.name)
|
||||
if self.doc.stock_uom and bin and cstr(bin[0][0]) \
|
||||
and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
|
||||
msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
|
||||
raise_exception=1)
|
||||
matched=True
|
||||
ref_uom = webnotes.conn.get_value("Stock Ledger Entry",
|
||||
{"item_code": self.doc.name, "is_cancelled": "No"}, "stock_uom")
|
||||
|
||||
if ref_uom:
|
||||
if cstr(ref_uom) != cstr(self.doc.stock_uom):
|
||||
matched = False
|
||||
else:
|
||||
bin_list = webnotes.conn.sql("select * from tabBin where item_code=%s",
|
||||
self.doc.item_code, as_dict=1)
|
||||
for bin in bin_list:
|
||||
if bin.reserved_qty > 0 or bin.ordered_qty > 0 or bin.indented_qty > 0 \
|
||||
or bin.planned_qty > 0 and cstr(bin.stock_uom) != cstr(self.doc.stock_uom):
|
||||
matched = False
|
||||
break
|
||||
|
||||
if matched and bin_list:
|
||||
webnotes.conn.sql("""update tabBin set stock_uom=%s where item_code=%s""",
|
||||
(self.doc.stock_uom, self.doc.name))
|
||||
|
||||
if not matched:
|
||||
webnotes.throw(_("Default Unit of Measure can not be changed directly \
|
||||
because you have already made some transaction(s) with another UOM.\n \
|
||||
To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
|
||||
|
||||
def validate_conversion_factor(self):
|
||||
check_list = []
|
||||
|
||||
Reference in New Issue
Block a user