fix: reword error messages, fix test values

This commit is contained in:
18alantom 2021-08-17 16:03:04 +05:30
parent cc177f3415
commit 7fb08173b5
2 changed files with 7 additions and 7 deletions

View File

@ -696,23 +696,23 @@ class BOM(WebsiteGenerator):
for item in self.scrap_items:
msg = ""
if item.item_code == self.item and not item.is_process_loss:
msg = _('Scrap/Loss Item: {0} should have Is Process Loss checked') \
msg = _('Scrap/Loss Item: {0} should have Is Process Loss checked as it is the same as the item to be manufactured or repacked.') \
.format(frappe.bold(item.item_code))
elif item.item_code != self.item and item.is_process_loss:
msg = _('Scrap/Loss Item: {0} should not have Is Process Loss checked') \
msg = _('Scrap/Loss Item: {0} should not have Is Process Loss checked as it is different from the item to be manufactured or repacked') \
.format(frappe.bold(item.item_code))
must_be_whole_number = frappe.get_value("UOM", item.stock_uom, "must_be_whole_number")
if item.is_process_loss and must_be_whole_number:
msg = _("Item: {0} with Stock UOM: {1} cannot be a Scrap/Loss Item") \
msg = _("Item: {0} with Stock UOM: {1} cannot be a Scrap/Loss Item as {1} is a whole UOM.") \
.format(frappe.bold(item.item_code), frappe.bold(item.stock_uom))
if item.is_process_loss and (item.stock_qty >= self.quantity):
msg = _("Scrap/Loss Item: {0} should have Qty less than finished goods Quantity") \
msg = _("Scrap/Loss Item: {0} should have Qty less than finished goods Quantity.") \
.format(frappe.bold(item.item_code))
if item.is_process_loss and (item.rate > 0):
msg = _("Scrap/Loss Item: {0} should have Rate set to 0 because Is Process Loss is checked") \
msg = _("Scrap/Loss Item: {0} should have Rate set to 0 because Is Process Loss is checked.") \
.format(frappe.bold(item.item_code))
if msg:

View File

@ -735,7 +735,7 @@ class TestWorkOrder(unittest.TestCase):
# Testing stock entry values
items = se.get("items")
self.assertEqual(len(items), 4, "There should be 3 items including process loss.")
self.assertEqual(len(items), 3, "There should be 3 items including process loss.")
source_item, fg_item, pl_item = items
@ -746,7 +746,7 @@ class TestWorkOrder(unittest.TestCase):
self.assertEqual(fg_item.qty, actual_fg_qty)
# Testing Work Order values
self.assertEqual(frappe.db.get_value("Work Order", wo.name, "produced_qty"), actual_fg_qty)
self.assertEqual(frappe.db.get_value("Work Order", wo.name, "produced_qty"), qty)
def get_scrap_item_details(bom_no):
scrap_items = {}