[OU-FIX] stock_account: skip non-existent accounts in COA backfill#102
Open
dnplkndll wants to merge 5 commits into
Open
[OU-FIX] stock_account: skip non-existent accounts in COA backfill#102dnplkndll wants to merge 5 commits into
dnplkndll wants to merge 5 commits into
Conversation
54e9760 to
667e41c
Compare
cf8e70d to
5d43045
Compare
4f9077b to
765d0ac
Compare
update_from_coa_generic builds company_data from the chart-of-accounts template and feeds it to AccountChartTemplate._load_data. When a template references an account that no longer resolves in the migrated database the load crashes. Guard the comprehension with ref_or_id(record_id, model_name) so only records resolving to an existing account are loaded.
… per move product.value in 19.0 is the history of MANUAL value overrides: _get_manual_value() takes the single LATEST row per move as the move's entire value and suppresses the landed-cost extra. The 1:1 layer rename makes the newest layer (typically a landed-cost adjustment) silently replace the whole move value on the first ORM recompute — posting a vendor bill against a migrated landed-cost receipt collapsed a $1,050 move to $50 and cascaded a wrong standard_price. Reproduced and fix validated on a minimal two-PO + landed-cost fixture (receipt values survive bill post + payment at $1,050).
18.0 layers carry a direction sign (deliveries negative); 19.0 stores the cost magnitude. A negative migrated value flips the anglo-saxon COGS entry when the delivery is invoiced post-migration (observed +400/-400 reversal: Cr COGS / Dr valuation on a migrated 4-unit delivery).
…und sign Pre-migration data builds a FIFO receipt with two layers (base + adjustment, the landed-cost shape) and a partial delivery; the post-migration tests assert one summed product.value row per move (the recompute path agrees at $1,050) and a positive outbound magnitude.
765d0ac to
6ca817a
Compare
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.
update_from_coa_genericfeeds_load_datatemplateaccount.accountrecords that don't exist in the company. For a non-resolving id,_load_datacreates the account from the filtered (stock-field-only) data — with noaccount_type— and the NOT NULL onaccount_account.account_typeaborts the migration. Restrictcompany_datato records that already resolve, so the backfill only updates existing accounts.