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.

AI-assisted (Claude Code); every change reviewed, tested, and owned by the author.

@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 4 times, most recently from 765d0ac to 6ca817a Compare June 19, 2026 11:58
@dnplkndll
dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch 5 times, most recently from 598a47c to d36b7cf Compare August 4, 2026 15:29
@dnplkndll
dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch from d36b7cf to 2d08799 Compare August 6, 2026 17:08
An unresolved chart-template xmlid returns an empty recordset, whose falsy
field read passes the not-set filter, so _load_data creates a phantom
account.account with no account_type and the migration dies on the NOT NULL
constraint (seen with company charts whose l10n module set is only partially
migrated).

Assisted-by: Claude Fable 5
… 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).

Assisted-by: Claude Fable 5
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).

Assisted-by: Claude Fable 5
…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.

Assisted-by: Claude Fable 5
@dnplkndll
dnplkndll force-pushed the 19.0-fix-stock-account-coa-account-type branch from 2d08799 to 883695d Compare August 7, 2026 14:16
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