-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][FIX] l10n_it_financial_statements_report P&L balance for period
- Loading branch information
1 parent
429f9ed
commit 75c2537
Showing
2 changed files
with
25 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import trial_balance | ||
from . import financial_statements_report | ||
from . import financial_statements_report_xlsx |
24 changes: 24 additions & 0 deletions
24
l10n_it_financial_statements_report/report/trial_balance.py
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,24 @@ | ||
from odoo import api, models | ||
|
||
|
||
class TrialBalanceReport(models.AbstractModel): | ||
_inherit = "report.account_financial_report.trial_balance" | ||
|
||
@api.model | ||
def _compute_account_amount( | ||
self, total_amount, tb_initial_acc, tb_period_acc, foreign_currency | ||
): | ||
total_amount = super()._compute_account_amount( | ||
total_amount, tb_initial_acc, tb_period_acc, foreign_currency | ||
) | ||
for tb in tb_initial_acc: | ||
acc_id = tb["account_id"] | ||
if tb["account_internal_group"] in ["expense", "income"]: | ||
total_amount[acc_id]["initial_balance"] = 0.0 | ||
total_amount[acc_id]["ending_balance"] = total_amount[acc_id]["balance"] | ||
if foreign_currency: | ||
total_amount[acc_id]["initial_currency_balance"] = 0.0 | ||
total_amount[acc_id]["ending_currency_balance"] += round( | ||
total_amount[acc_id]["amount_currency"], 2 | ||
) | ||
return total_amount |