[19.0][ADD] hr_expense_tax_distribution#345
Closed
dnplkndll wants to merge 2 commits into
Closed
Conversation
e2dbf26 to
0ce40ea
Compare
0ce40ea to
35d1f0b
Compare
35d1f0b to
4f05f21
Compare
Author
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.
Adds the new module
hr_expense_tax_distributionon 19.0.Origin: ported from an internal Akretion working branch authored by Guillaume Masson guillaume.masson@akretion.com. The module does not exist on any earlier OCA series (14.0–18.0), so this is a fresh
[ADD]to OCA/hr-expense rather than a[MIG]from a prior series — the[ADD]prefix also routes/ocabot mergeto the right (minor) bump.What it does
When a single expense receipt carries multiple VAT rates (a French restaurant bill at 5.5% / 10% / 20% is the canonical case), Odoo's stock
tax_idsfield can only carry one rate against the full total. This module adds atax_line_idsone2many onhr.expensewhere the user splits the receipt total across as many tax-rate lines as needed, each holding a base amount and the applicable taxes; the resulting accounting move is built from those lines instead of the singletax_ids/ total pair, producing a correct VAT breakdown. A_constraint_total_matchesconstraint blocks submit unless the distribution lines sum back to the expense total.When no distribution lines are present (
has_tax_distribution = False), the form hides the section and the module is a no-op — the expense flows through stock 19.0 paths unchanged.Non-mechanical adaptations worth flagging
hr.expense.sheet. Odoo 19 collapsed expense reports into expense lines, so this port overrides_prepare_receipts_vals()and_prepare_payments_vals()onhr.expensedirectly to inject the per-rate tax lines into the accounting entry without going through the (now-removed) sheet model._post_without_wizard), and converted assertions to the 19.0expense.state/approval_statemachine.self.env._()throughout instead of module-level_().Test coverage
tests/test_hr_expense_tax_distribution.py— 22 test methods covering: compute paths onhr.expense.tax.line(single tax, multi-tax, zero base, no tax); thehas_tax_distributionboolean; onchange rebuild semantics whentax_idschanges (adding, removing, preserving base amounts); the sum-matches constraint (matches, mismatches, zero-total, negative-base); and the accounting move generation (price_unit × quantity, account move amounts).