[MIG] account_financial_report: Migration to 14.0

Since v14, Odoo defines the `__slots__` attribute in the `BaseModel` class (ea3e39506a)
This makes it impossible to add attributes to an instance like it was done here in v13.
The use of the `report_data` dictionary passed between method is the closes and simples solution to this "issue".

TT26415

Co-authored-by: Alex Cuellar <acuellar@grupoyacck.com>
This commit is contained in:
João Marques
2021-01-25 15:43:26 +00:00
committed by chaule97
parent e250c0583d
commit 12034178bb
30 changed files with 762 additions and 649 deletions

View File

@@ -539,7 +539,7 @@ class TrialBalanceReport(models.AbstractModel):
groups_data[group.id].update(
{
"id": group.id,
"code": group.code_prefix,
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
@@ -573,7 +573,7 @@ class TrialBalanceReport(models.AbstractModel):
{
group.id: {
"id": group.id,
"code": group.code_prefix,
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
@@ -620,12 +620,12 @@ class TrialBalanceReport(models.AbstractModel):
groups = self.env["account.group"].search([("id", "!=", False)])
groups_data = {}
for group in groups:
len_group_code = len(group.code_prefix)
len_group_code = len(group.code_prefix_start)
groups_data.update(
{
group.id: {
"id": group.id,
"code": group.code_prefix,
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
@@ -644,7 +644,7 @@ class TrialBalanceReport(models.AbstractModel):
groups_data[group.id]["initial_currency_balance"] = 0.0
groups_data[group.id]["ending_currency_balance"] = 0.0
for account in accounts_data.values():
if group.code_prefix == account["code"][:len_group_code]:
if group.code_prefix_start == account["code"][:len_group_code]:
acc_id = account["id"]
group_id = group.id
groups_data[group_id]["initial_balance"] += total_amount[acc_id][