-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91f3290
commit 8a2041d
Showing
15 changed files
with
350 additions
and
228 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
# Copyright 2022 Quartile Limited | ||
# Copyright 2022-2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from contextlib import contextmanager | ||
|
||
from odoo import models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
# For journal entries | ||
def _recompute_tax_lines( | ||
self, recompute_tax_base_amount=False, tax_rep_lines_to_recompute=None | ||
@contextmanager | ||
def _sync_dynamic_line( | ||
self, | ||
existing_key_fname, | ||
needed_vals_fname, | ||
needed_dirty_fname, | ||
line_type, | ||
container, | ||
): | ||
self.ensure_one() | ||
if self.company_id.need_tax_round_down: | ||
self = self.with_context(rounding_method="DOWN") | ||
return super()._recompute_tax_lines( | ||
recompute_tax_base_amount=recompute_tax_base_amount, | ||
tax_rep_lines_to_recompute=tax_rep_lines_to_recompute, | ||
) | ||
|
||
# For invoice form and print total presentation. | ||
# Extending _get_tax_totals() would also work for invoices, however not for sales | ||
# orders. Therefore _compute_tax_totals_json() is extended for consistency reason. | ||
def _compute_tax_totals_json(self): | ||
if self.env.company.need_tax_round_down: | ||
if line_type == "tax" and self.env.company.need_tax_round_down: | ||
self = self.with_context(rounding_method="DOWN") | ||
return super()._compute_tax_totals_json() | ||
with super()._sync_dynamic_line( | ||
existing_key_fname, | ||
needed_vals_fname, | ||
needed_dirty_fname, | ||
line_type, | ||
container, | ||
) as ret: | ||
yield ret |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
Go to Accounting (or Invoicing) \> Configuration \> Settings, and select | ||
"Round-down Tax Amounts" for companies where tax amounts should be | ||
rownded down (selection is done by default). | ||
Go to *Accounting (or Invoicing) \> Configuration \> Settings*, and select "Round-down | ||
Tax Amounts" for companies whose tax amounts should be rounded down. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
By default, Odoo uses the "HALF-UP" method to round tax amounts. However, in some | ||
regions, such as Japan, some industries have a common practice of rounding down instead. | ||
This module accommodates such local conventions by offering an alternate rounding method. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Quartile \<<https://www.quartile.co>\> | ||
- Yoshi Tashiro |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,2 @@ | ||
This module does the following: | ||
|
||
- Provides the function of rounding down the tax amount in the invoice, | ||
covering: | ||
- the total presentation in invoice form/print | ||
- the tax amount calculation of account move line | ||
|
||
Note that, due to the structure of compute_all() method, the round-down | ||
does not work perfectly in case the document involves multiple taxes | ||
with different price_include settings (which is not expected to happen | ||
under normal circumstances in the Japanese business environment). | ||
|
||
## Background: | ||
|
||
In Japan there is sometimes a tacit industry-wide convention of rounding | ||
down the tax amount instead of applying the default rounding | ||
("HALF-UP"). | ||
This module provides the function of rounding down the tax amount in invoices (and also | ||
other business documents such as sales orders and purchase orders). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Due to the structure of the compute_all() method in the tax model, rounding down may | ||
not yield the expected results in cases where tax-inclusive pricing is used. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
With the round-down setting enabled, if you create an invoice in JPY with the following line: | ||
|
||
- Quantity: 1 | ||
- Unit Price: 15 | ||
- Tax: 10% (excluded) | ||
|
||
the calculated tax amount will be 1 instead of 2. |
Oops, something went wrong.