UOM validation for BOM Items
This commit is contained in:
parent
aacb0a702e
commit
c5fb88c1cd
@ -27,7 +27,7 @@ class BOM(Document):
|
|||||||
self.validate_main_item()
|
self.validate_main_item()
|
||||||
|
|
||||||
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
||||||
validate_uom_is_integer(self, "stock_uom", "qty")
|
validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
|
||||||
|
|
||||||
self.validate_operations()
|
self.validate_operations()
|
||||||
self.validate_materials()
|
self.validate_materials()
|
||||||
|
@ -95,7 +95,7 @@ def delete_events(ref_type, ref_name):
|
|||||||
|
|
||||||
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
||||||
|
|
||||||
def validate_uom_is_integer(doc, uom_field, qty_fields):
|
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
||||||
if isinstance(qty_fields, basestring):
|
if isinstance(qty_fields, basestring):
|
||||||
qty_fields = [qty_fields]
|
qty_fields = [qty_fields]
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ def validate_uom_is_integer(doc, uom_field, qty_fields):
|
|||||||
if not integer_uoms:
|
if not integer_uoms:
|
||||||
return
|
return
|
||||||
|
|
||||||
for d in doc.get_all_children():
|
for d in doc.get_all_children(parenttype=child_dt):
|
||||||
if d.get(uom_field) in integer_uoms:
|
if d.get(uom_field) in integer_uoms:
|
||||||
for f in qty_fields:
|
for f in qty_fields:
|
||||||
if d.get(f):
|
if d.get(f):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user