Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] sale_margin_tax #213

Open
wants to merge 6 commits into
base: 16.0
Choose a base branch
from

Conversation

len-foss
Copy link

This module takes a simple approach to the Belgian margin tax.

https://finances.belgium.be/fr/entreprises/tva/assujettissement-tva/regime-imposition-marge

With this, the tax is due on the margin, that is to say the benefit made between the purchase price and the selling price of used goods (not taking into account any cost incurred in between, including refurbishing or repairing costs).

Note that the seller has to be able to track the purchasing price in their inventory.
There are different ways this can be done - by lot, serial number, retrieved from the purchase order, etc.
By default, this module assumes that the purchase price is the same as the cost encoded on the product.
This advanced behaviour can be implemented on overriding modules.

When such a tax is used, the actual tax amount has to be computed at invoicing time.
Moreover, the actual tax amount should be hidden from the report, and an obligatory note has to be present on the invoice.

@len-foss
Copy link
Author

Hello @rousseldenis!
Since you worked with margin tax :-)

In 16.0 it requires more work to hide the tax information in the report -- I'm not sure I've taken the best approach, and it is annoying as it also hides the margin tax total in the backend (maybe there needs to be a context key to know if _prepare_tax_totals is used in the context of the customer report or internally).

When accounting for margin tax sales, the purchase price
and margin (that form the base for the tax lines) need to be split.
This is because a different tax grid should be applied on both line.
However, Odoo does not provide a way to split the base as it does to
split the tax. Furthermore, adding a 'margin' line type does not work
because the functions that apply the repartition lines etc are basically
impossible to override (they do not provide any hook,
and the arbitrary compute order would make any tentative very brittle).
To avoid these difficulty, another line is created on a "margin" product
(a service), so that both the purchase and the margin can be accounted
as base lines.

This provide the advantage that no further override of basic accounting
functions are needed, and that the tax rate of the margin tax is always
either the initial rate (say 21) or 0.

The downside is that it makes so statistics harder.
Since the margin line and the product lines are linked by a many2one,
it is still possible to extract the relevant info, just a bit harder.

This refactoring also merges the margin behaviour from invoice and sale
into a mixin to avoid desync of the essentially duplicated code
(if only both line/tax fields had the same name...).
This solved a bug where an invoice would think to be margin-based but
without finding a witness margin tax.

Last, this now handles the case where the margin is negative,
in which case no tax is due.
Copy link

github-actions bot commented Oct 6, 2024

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant