test: add test for new QI function

This commit is contained in:
Rohan Bansal
2021-06-02 14:55:31 +05:30
parent 11aff80dea
commit a06ec03efc
3 changed files with 103 additions and 56 deletions

View File

@@ -504,9 +504,10 @@ class StockController(AccountsController):
@frappe.whitelist()
def make_quality_inspections(doctype, docname, items):
items = json.loads(items).get('items')
inspections = []
if isinstance(items, str):
items = json.loads(items)
inspections = []
for item in items:
if flt(item.get("sample_size")) > flt(item.get("qty")):
frappe.throw(_("{item_name}'s Sample Size ({sample_size}) cannot be greater than the Accepted Quantity ({accepted_quantity})").format(