Skip to content

Commit

Permalink
fix: sample size validation added
Browse files Browse the repository at this point in the history
  • Loading branch information
vishdha committed Aug 26, 2020
1 parent 2bda676 commit faf31e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erpnext/public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ $(document).on('app_ready', function() {
],
primary_action: function () {
const values = dialog.get_values().items;
values.forEach(item=>{
if(item.qty < item.sample_size) {
frappe.throw(__("Row #{0}: The sample size: {1} should be less than available qty: {2}", [item.idx, item.sample_size, item.qty]));
}
})
frappe.call({
method: "erpnext.stock.doctype.quality_inspection.quality_inspection.make_quality_inspections",
freeze: true,
Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def validate_quality_inspection_item(doc, items):
"reference_name": item.get("parent"),
"item_code": item.get("item_code"),
"item_name": item.get("item_name"),
"qty": item.get("qty"),
"inspection_type": inspection_type_map[doc.get("doctype")][0]
})
return data

0 comments on commit faf31e2

Please sign in to comment.