Repository navigation
[OU-FIX] account: fill tax repartition document_type - #17
Merged
Merged
Conversation
Co-authored-by: André de Kock <[email protected]>
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.
Symptom
Root cause
document_type(invoice/refund) is required onaccount.tax.repartition.linein 19.0 and in 20.0. The 20.0 analysis does not list it as a new or changed field. Databases that started before Odoo 16 can still have NULL rows from the version that added the column: the NOT NULL constraint was never applied, and each later upgrade reports it again as a missing constraint.Change
Account pre-migration fills NULL
document_type:out_refund,in_refund) and not on invoices or receipts becomesrefund. Usage is read fromaccount_move_line.tax_repartition_line_idjoined toaccount_move.move_type.invoice. That is the document type Odoo creates first on a tax.The note is on the
account.tax.repartition.line/tag_ids_domainanalysis line, becausedocument_typeitself has no analysis entry.Verification
Confirmed
document_type = fields.Selection(..., required=True)in Odoo 19 and Odoo 20account.tax.repartition.line.ruffis clean. No database upgrade was run. No OCA pull request backfills this column for 20.0.Upstream
Generic. Submit to OCA
20.0on top of OCA#6068. The same NULL rows would warn on 17.0, 18.0 and 19.0 as well; this PR only adds the 20.0 script, which is where the warning was reported. A database that reaches 20.0 still has the NULLs, so fixing it here is enough for that upgrade.Limitation
A line used on both invoices and refunds, or not used at all, is marked
invoice. If it was actually a refund line that was never posted, the tax refund repartition is wrong until someone edits the tax. There is no other stored signal on the repartition line itself.