[IMP] account_financial_report: Remove 'Computed Accounts' option from 'trial balance'.

This commit is contained in:
Ernesto Tejeda
2022-05-31 00:14:19 -04:00
committed by chaule97
parent 9efca74d7d
commit 4af9e021a7
26 changed files with 544 additions and 975 deletions

View File

@@ -46,56 +46,22 @@
<t t-foreach="trial_balance" t-as="balance">
<!-- Adapt -->
<t t-set="style" t-value="'font-size:12px;'" />
<t t-if="hierarchy_on == 'none'">
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
<t t-if="hierarchy_on == 'computed'">
<t t-if="balance['type'] == 'group_type'">
<t t-if="show_hierarchy">
<t t-if="limit_hierarchy_level">
<t
t-set="style"
t-value="style + 'font-weight: bold; color: blue;'"
/>
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
<t t-if="balance['type'] == 'account_type'">
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
</t>
<!-- <t t-set="padding" t-value="line.level * 4"/>-->
<!-- <t t-if="hierarchy_on != 'none'">-->
<!-- <t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>-->
<!-- </t>-->
<t t-if="hierarchy_on == 'relation'">
<t t-if="balance['type'] == 'group_type'">
<t
t-set="style"
t-value="style + 'font-weight: bold; color: blue;'"
/>
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
<t t-if="balance['type'] == 'account_type'">
<t t-if="limit_hierarchy_level">
<t t-if="show_hierarchy_level > balance['level']">
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
</t>
<t t-if="not limit_hierarchy_level">
t-if="show_hierarchy_level > balance['level'] and (not hide_parent_hierarchy_level or (show_hierarchy_level - 1) == balance['level'])"
>
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
</t>
</t>
<t t-else="">
<t
t-call="account_financial_report.report_trial_balance_line"
/>
</t>
</t>
</div>
</t>

View File

@@ -662,7 +662,7 @@ class TrialBalanceReport(models.AbstractModel):
date_to = data["date_to"]
date_from = data["date_from"]
hide_account_at_0 = data["hide_account_at_0"]
hierarchy_on = data["hierarchy_on"]
show_hierarchy = data["show_hierarchy"]
show_hierarchy_level = data["show_hierarchy_level"]
foreign_currency = data["foreign_currency"]
only_posted_moves = data["only_posted_moves"]
@@ -706,7 +706,7 @@ class TrialBalanceReport(models.AbstractModel):
],
}
)
if hierarchy_on == "relation":
if show_hierarchy:
groups_data = self._get_groups_data(
accounts_data, total_amount, foreign_currency
)
@@ -716,14 +716,7 @@ class TrialBalanceReport(models.AbstractModel):
for trial in trial_balance:
counter = trial["complete_code"].count("/")
trial["level"] = counter
if hierarchy_on == "computed":
groups_data = self._get_computed_groups_data(
accounts_data, total_amount, foreign_currency
)
trial_balance = list(groups_data.values())
trial_balance += list(accounts_data.values())
trial_balance = sorted(trial_balance, key=lambda k: k["code"])
if hierarchy_on == "none":
else:
trial_balance = list(accounts_data.values())
trial_balance = sorted(trial_balance, key=lambda k: k["code"])
else:
@@ -749,7 +742,8 @@ class TrialBalanceReport(models.AbstractModel):
"hide_account_at_0": data["hide_account_at_0"],
"show_partner_details": data["show_partner_details"],
"limit_hierarchy_level": data["limit_hierarchy_level"],
"hierarchy_on": hierarchy_on,
"show_hierarchy": show_hierarchy,
"hide_parent_hierarchy_level": data["hide_parent_hierarchy_level"],
"trial_balance": trial_balance,
"total_amount": total_amount,
"accounts_data": accounts_data,

View File

@@ -183,7 +183,7 @@ class TrialBalanceXslx(models.AbstractModel):
total_amount = res_data["total_amount"]
partners_data = res_data["partners_data"]
accounts_data = res_data["accounts_data"]
hierarchy_on = res_data["hierarchy_on"]
show_hierarchy = res_data["show_hierarchy"]
show_partner_details = res_data["show_partner_details"]
show_hierarchy_level = res_data["show_hierarchy_level"]
foreign_currency = res_data["foreign_currency"]
@@ -195,21 +195,13 @@ class TrialBalanceXslx(models.AbstractModel):
# For each account
if not show_partner_details:
for balance in trial_balance:
if hierarchy_on == "relation":
if show_hierarchy:
if limit_hierarchy_level:
if show_hierarchy_level > balance["level"]:
# Display account lines
self.write_line_from_dict(balance, report_data)
else:
self.write_line_from_dict(balance, report_data)
elif hierarchy_on == "computed":
if balance["type"] == "account_type":
if limit_hierarchy_level:
if show_hierarchy_level > balance["level"]:
# Display account lines
self.write_line_from_dict(balance, report_data)
else:
self.write_line_from_dict(balance, report_data)
else:
self.write_line_from_dict(balance, report_data)
else: