mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-20 03:47:11 +00:00
fix(stock): correct secondary item valuation across stock entry purposes
Backport of five fixes merged to develop, adapted to this branch, where the field is still named `type` and the stock entry rate logic has not been split out of set_basic_rate. - A secondary row with no BOM link is costed out of the finished good, as legacy scrap was. Finished goods are rated last so a single validate pass sees the secondary rows' amounts. (#57732) - Repack no longer flags secondary rows as finished goods, so each side takes the share the BOM declares instead of the scrap absorbing the finished good's percentage. (#57735) - A BOM allocation of 0% means the row carries no cost, rather than falling through to the item's own valuation rate. (#57736) - Secondary Item Type no longer waives a quality inspection on purposes that do not produce secondary items. (#57737) - The BOM allocation applies to the consumption entry's cost when the raw material cost comes from one. (#57738) Replaces the individual backports, which could not be cherry-picked cleanly: every hunk needed rewriting against the pre-rename field and the un-refactored rate logic.
This commit is contained in:
@@ -20,8 +20,10 @@ erpnext.stock.qi_outgoing_purposes = [
|
||||
];
|
||||
erpnext.stock.is_incoming_qi_purpose = (purpose) =>
|
||||
purpose === "Manufacture" || erpnext.stock.qi_incoming_purposes.includes(purpose);
|
||||
erpnext.stock.secondary_item_purposes = ["Manufacture", "Repack", "Disassemble"];
|
||||
erpnext.stock.row_requires_quality_inspection = (purpose, row) => {
|
||||
if (row.type || row.is_legacy_scrap_item) return false;
|
||||
if (erpnext.stock.secondary_item_purposes.includes(purpose) && (row.type || row.is_legacy_scrap_item))
|
||||
return false;
|
||||
if (purpose === "Manufacture") return !!row.is_finished_item;
|
||||
if (erpnext.stock.qi_incoming_purposes.includes(purpose)) return !!row.t_warehouse;
|
||||
if (erpnext.stock.qi_outgoing_purposes.includes(purpose))
|
||||
|
||||
Reference in New Issue
Block a user