Repository navigation
[19.0][FIX] stock_account: don't create missing accounts from the chart template - #6067
Closed
JordiBForgeFlow wants to merge 1 commit into
Closed
JordiBForgeFlow wants to merge 1 commit into
JordiBForgeFlow wants to merge 1 commit into
Conversation
…plate update_from_coa_generic() only means to fill the new stock fields on existing records, but when a template record has those fields and the company doesn't have it (e.g. the account was deleted), ref() returns an empty recordset, the record passes the filter and _load_data() tries to create it with only the stock fields: null value in column "name" of relation "account_account" violates not-null constraint Skip template records that don't exist in the company.
Member
Author
Contributor
|
Same as #5890. |
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.
Problem
During the migration, stock_account fills in the new stock settings of each company's accounts using the company's chart of accounts as a reference.
If a company has deleted, or never had, one of the accounts in its chart of accounts, the migration tries to create that missing account instead of skipping it. It only has the stock settings to create it with, not a name, so the migration stops with this error:
null value in column "name" of relation "account_account" violates not-null constraint
We found it migrating a Spanish company (es_pymes) that doesn't have account 310 "Raw materials A".
Fix
The migration now updates only the accounts that exist in the company and skips the missing ones, as it was meant to. It doesn't create accounts and doesn't change the result for companies that have all of them.
Assisted by AI