mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 23:39:28 +00:00
* fix(stock): distribute additional costs when incoming items have no value when every incoming row has zero basic amount, for example a raw material purchased at zero rate, distribute_additional_costs returned early and left additional_cost at 0 on the finished item. the charges were never capitalised into valuation and the balancing debit stayed in stock adjustment instead of reaching stock in hand. the gl composer had its own quantity fallback for the same case, but it divided by the qty of every row rather than the incoming ones, so a manufacture entry booked only a fraction of the cost to the expense account, and it apportioned by qty while valuation apportions by stock qty, which split rows of differing conversion factors two different ways. both sides now take the rows, the basis and its total from a single get_additional_cost_allocation, falling back to transfer_qty so valuation and gl cannot disagree. the basis is unchanged whenever the incoming rows carry value. * test(stock): cover additional cost distribution for zero valued items adds qty based distribution cases for manufacture and material receipt, a manufacture entry asserting the whole cost reaches its expense account, and a conversion factor case asserting the gl split matches the valuation split. updates test_total_basic_amount_zero, which asserted the cost landing in stock adjustment rather than being capitalised.