Skip to content

[OU-FIX] stock_account: skip non-existent accounts in COA backfill#102

Open
dnplkndll wants to merge 5 commits into
19.0from
19.0-fix-stock-account-coa-account-type
Open

[OU-FIX] stock_account: skip non-existent accounts in COA backfill#102
dnplkndll wants to merge 5 commits into
19.0from
19.0-fix-stock-account-coa-account-type

Conversation

@dnplkndll

@dnplkndll dnplkndll commented Jun 3, 2026

Copy link
Copy Markdown

update_from_coa_generic feeds _load_data template account.account records that don't exist in the company. For a non-resolving id, _load_data creates the account from the filtered (stock-field-only) data — with no account_type — and the NOT NULL on account_account.account_type aborts the migration. Restrict company_data to records that already resolve, so the backfill only updates existing accounts.

@dnplkndll dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch from 54e9760 to 667e41c Compare June 3, 2026 16:43
@dnplkndll dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch 2 times, most recently from cf8e70d to 5d43045 Compare June 5, 2026 19:53
@dnplkndll dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch 3 times, most recently from 4f9077b to 765d0ac Compare June 17, 2026 12:44
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.
@dnplkndll dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch from 765d0ac to 6ca817a Compare June 19, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant