[IMP] account_financial_report: Add Missing partner support in trial balance
If there are records without partner_id set and we show the detail of partners we need to take into account those records grouped as "Missing partner". TT47771pull/1114/head
parent
808b3ca5ab
commit
c7b93a6c76
|
@ -4,7 +4,7 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
|
||||||
from odoo import api, models
|
from odoo import _, api, models
|
||||||
from odoo.tools.float_utils import float_is_zero
|
from odoo.tools.float_utils import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,31 +280,31 @@ class TrialBalanceReport(models.AbstractModel):
|
||||||
partners_data = {}
|
partners_data = {}
|
||||||
for tb in tb_period_prt:
|
for tb in tb_period_prt:
|
||||||
acc_id = tb["account_id"][0]
|
acc_id = tb["account_id"][0]
|
||||||
if tb["partner_id"]:
|
prt_id = tb["partner_id"][0] if tb["partner_id"] else 0
|
||||||
prt_id = tb["partner_id"][0]
|
if prt_id not in partners_ids:
|
||||||
if tb["partner_id"] not in partners_ids:
|
partner_name = (
|
||||||
partners_data.update(
|
tb["partner_id"][1] if tb["partner_id"] else _("Missing Partner")
|
||||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1]}}
|
|
||||||
)
|
|
||||||
total_amount[acc_id][prt_id] = self._prepare_total_amount(
|
|
||||||
tb, foreign_currency
|
|
||||||
)
|
)
|
||||||
total_amount[acc_id][prt_id]["credit"] = tb["credit"]
|
partners_data.update({prt_id: {"id": prt_id, "name": partner_name}})
|
||||||
total_amount[acc_id][prt_id]["debit"] = tb["debit"]
|
total_amount[acc_id][prt_id] = self._prepare_total_amount(
|
||||||
total_amount[acc_id][prt_id]["balance"] = tb["balance"]
|
tb, foreign_currency
|
||||||
total_amount[acc_id][prt_id]["initial_balance"] = 0.0
|
)
|
||||||
partners_ids.add(tb["partner_id"])
|
total_amount[acc_id][prt_id]["credit"] = tb["credit"]
|
||||||
|
total_amount[acc_id][prt_id]["debit"] = tb["debit"]
|
||||||
|
total_amount[acc_id][prt_id]["balance"] = tb["balance"]
|
||||||
|
total_amount[acc_id][prt_id]["initial_balance"] = 0.0
|
||||||
|
partners_ids.add(prt_id)
|
||||||
for tb in tb_initial_prt:
|
for tb in tb_initial_prt:
|
||||||
acc_id = tb["account_id"][0]
|
acc_id = tb["account_id"][0]
|
||||||
if tb["partner_id"]:
|
prt_id = tb["partner_id"][0] if tb["partner_id"] else 0
|
||||||
prt_id = tb["partner_id"][0]
|
if prt_id not in partners_ids:
|
||||||
if tb["partner_id"] not in partners_ids:
|
partner_name = (
|
||||||
partners_data.update(
|
tb["partner_id"][1] if tb["partner_id"] else _("Missing Partner")
|
||||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1]}}
|
|
||||||
)
|
|
||||||
total_amount = self._compute_acc_prt_amount(
|
|
||||||
total_amount, tb, acc_id, prt_id, foreign_currency
|
|
||||||
)
|
)
|
||||||
|
partners_data.update({prt_id: {"id": prt_id, "name": partner_name}})
|
||||||
|
total_amount = self._compute_acc_prt_amount(
|
||||||
|
total_amount, tb, acc_id, prt_id, foreign_currency
|
||||||
|
)
|
||||||
return total_amount, partners_data
|
return total_amount, partners_data
|
||||||
|
|
||||||
def _remove_accounts_at_cero(self, total_amount, show_partner_details, company):
|
def _remove_accounts_at_cero(self, total_amount, show_partner_details, company):
|
||||||
|
|
Loading…
Reference in New Issue