fix: recalculate plot costs replace broken SR with ledger update + handover fixes#40
Merged
av-dev2 merged 1 commit intoMay 31, 2026
Conversation
…dger update ERPNext v15's Stock Reconciliation corrupts serial number status (sets to Delivered) and fails on second run with serial bundle qty mismatch. Replace the SR with targeted db.set_value calls on Plot Master, Serial No, Stock Ledger Entry, and Serial and Batch Bundle so COGS at handover matches allocated_cost without any stock movement side-effects. Also fix Plot Handover delivery note creation: always source warehouse from LandMS Settings (not SO), set incoming_rate from plot.allocated_cost, and auto-cancel any legacy blocking Stock Reconciliations before DN submit.
|
Successfully created backport PR for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recalculate Plot Costs: ERPNext v15's Stock Reconciliation corrupts
serial number status on first run and crashes with bundle qty mismatch
on subsequent runs. Replaced entirely with direct
db.set_valueonfour targets per plot:
Plot Master.allocated_cost/cost_per_sqm,Serial No.purchase_rate,Stock Ledger Entry.incoming_rate/ stock_value_difference, andSerial and Batch Bundle.avg_rate/ total_amount. The existing Repost Item Valuation then correctlypropagates the new cost to GL entries.
Plot Handover: Fixed DN warehouse to always read from LandMS Settings
plot_inventory_warehouseinstead of inheriting from SO (which caused"serial in different warehouse" error). Set
incoming_ratefromplot.allocated_coston all DN item paths so COGS = allocated cost.Added
_cancel_blocking_stock_reconciliationsto auto-cancel any legacySRs that would block DN submission with "Serial No Exists In Future
Transaction" error.