diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index e2a556f85c1..27856b5f317 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -589,25 +589,28 @@ class BOM(WebsiteGenerator): def validate_scrap_items(self): for item in self.scrap_items: if item.item_code == self.item and not item.is_process_loss: - frappe.throw(_('Scrap/Loss Item:') + f' {frappe.bold(item.item_code)} ' +\ - _('should have') + ' ' + frappe.bold(_('Is Process Loss')) + ' ' + ('checked.')) + frappe.throw(_('Scrap/Loss Item:') + f' {frappe.bold(item.item_code)} ' + + _('should have') + ' ' + frappe.bold(_('Is Process Loss')) + ' ' + ('checked')) elif item.item_code != self.item and item.is_process_loss: - frappe.throw(_('Scrap/Loss Item:') + f' {frappe.bold(item.item_code)} ' +\ - _('should not have') + ' ' + frappe.bold(_('Is Process Loss')) + ' ' + ('checked.')) + frappe.throw(_('Scrap/Loss Item:') + f' {frappe.bold(item.item_code)} ' + + _('should not have') + ' ' + frappe.bold(_('Is Process Loss')) + ' ' + ('checked')) - stock_uom = item.stock_uom - must_be_whole_number = frappe.get_value("UOM", stock_uom, "must_be_whole_number") + 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: - frappe.throw(_('Item:') + f' {frappe.bold(item.item_code)} ' +\ - _('with Stock UOM:') + f' {frappe.bold(stock_uom)} '+\ - _('cannot be a Scrap/Loss Item.')) + frappe.throw(_('Item:') + f' {frappe.bold(item.item_code)} ' + + _('with Stock UOM:') + f' {frappe.bold(item.stock_uom)} ' + + _('cannot be a Scrap/Loss Item')) if item.is_process_loss and (item.stock_qty >= self.quantity): - frappe.throw(_('Scrap/Loss Item:') + f' {item.item_code} ' +\ - _('should have') +' '+frappe.bold(_('Qty')) +\ - ' ' + _('less than finished goods') + ' ' +\ - frappe.bold(_('Quantity.'))) + frappe.throw(_('Scrap/Loss Item:') + f' {item.item_code} ' + + _('should have') +' '+frappe.bold(_('Qty')) + ' ' + + _('less than finished goods') + ' ' + frappe.bold(_('Quantity'))) + if item.is_process_loss and (item.rate > 0): + frappe.throw(_('Scrap/Loss Item:') + f' {item.item_code} ' + + _('should have') + ' ' + frappe.bold(_('Rate')) + + ' ' + _('set to 0 because') + ' ' + + frappe.bold(_('Is Process Loss')) + ' ' + _('is checked')) def get_bom_item_rate(args, bom_doc): if bom_doc.rm_cost_as_per == 'Valuation Rate': diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4cdfcc47bdb..c9070ffa268 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -333,7 +333,7 @@ class StockEntry(StockController): if self.purpose == "Manufacture": if validate_for_manufacture: - if d.is_finished_item or d.is_scrap_item: + if d.is_finished_item or d.is_scrap_item or d.is_process_loss: d.s_warehouse = None if not d.t_warehouse: frappe.throw(_("Target warehouse is mandatory for row {0}").format(d.idx))