[IMP] account_financial_report: pre-commit auto fixes

This commit is contained in:
chaule97
2024-11-13 10:18:04 +07:00
parent 4413611f93
commit c46e83a4a4
16 changed files with 257 additions and 267 deletions

View File

@@ -610,8 +610,8 @@ class AbstractReportXslx(models.AbstractModel):
def _get_report_complete_name(self, report, prefix, data=None):
if report.company_id:
suffix = " - {} - {}".format(
report.company_id.name, report.company_id.currency_id.name
suffix = (
f" - {report.company_id.name} - {report.company_id.currency_id.name}"
)
return prefix + suffix
return prefix

View File

@@ -517,9 +517,9 @@ class GeneralLedgerReport(models.AbstractModel):
"balance"
]
if foreign_currency:
gen_ld_data[acc_id][item_id]["fin_bal"][
"bal_curr"
] += move_line["amount_currency"]
gen_ld_data[acc_id][item_id]["fin_bal"]["bal_curr"] += (
move_line["amount_currency"]
)
else:
gen_ld_data[acc_id][ml_id] = self._get_move_line_data(move_line)
gen_ld_data[acc_id]["fin_bal"]["credit"] += move_line["credit"]

View File

@@ -93,9 +93,9 @@ class JournalLedgerReport(models.AbstractModel):
return "move_id"
def _get_move_lines_data(self, ml, wizard, ml_taxes, auto_sequence, exigible):
base_debit = (
base_credit
) = tax_debit = tax_credit = base_balance = tax_balance = 0.0
base_debit = base_credit = tax_debit = tax_credit = base_balance = (
tax_balance
) = 0.0
if exigible:
base_debit = ml_taxes and ml.debit or 0.0
base_credit = ml_taxes and ml.credit or 0.0
@@ -312,11 +312,9 @@ class JournalLedgerReport(models.AbstractModel):
if key not in journal_moves_data.keys():
journal_moves_data[key] = []
journal_moves_data[key] += list(items)
move_lines_data = (
account_ids_data
) = (
partner_ids_data
) = currency_ids_data = tax_line_ids_data = move_line_ids_taxes_data = {}
move_lines_data = account_ids_data = partner_ids_data = currency_ids_data = (
tax_line_ids_data
) = move_line_ids_taxes_data = {}
if move_ids:
move_lines = self._get_move_lines(move_ids, wizard, journal_ids)
move_lines_data = move_lines[1]

View File

@@ -130,7 +130,9 @@
</t>
<!--## dynamic columns-->
<t t-foreach="age_partner_config.line_ids" t-as="column_dynamic">
<div class="act_as_cell"><span t-out="column_dynamic.name" /></div>
<div class="act_as_cell">
<span t-out="column_dynamic.name" />
</div>
</t>
</div>
</div>
@@ -149,9 +151,9 @@
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
<!--## current-->
<!--## current-->
<div class="act_as_cell amount">
<span
<span
t-esc="partner['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
@@ -357,26 +359,26 @@
/>
</span>
</div>
<!--## current-->
<div class="act_as_cell amount">
<t t-if="line['current'] == 0">
<span
<!--## current-->
<div class="act_as_cell amount">
<t t-if="line['current'] == 0">
<span
t-esc="line['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</t>
<t t-else="">
<span
</t>
<t t-else="">
<span
domain="[('id', 'in', (line['line_rec'] | line['line_rec'].matched_debit_ids.mapped('debit_move_id') | line['line_rec'].matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
<t
t-out="line['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
</span>
</t>
</div>
<t t-if="not age_partner_config">
<!--## age_30_days-->
<div class="act_as_cell amount">
@@ -522,13 +524,13 @@
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 6.00%;">
<span
<!--## current-->
<div class="act_as_cell amount" style="width: 6.00%;">
<span
t-esc="partner_cumul_line['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
</div>
<t t-if="not age_partner_config">
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 6.00%;">
@@ -591,13 +593,13 @@
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span
<!--## current-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span
t-esc="account['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
</div>
<t t-if="not age_partner_config">
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 9.64%;">
@@ -656,13 +658,13 @@
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 6.00%">
<span
<!--## current-->
<div class="act_as_cell amount" style="width: 6.00%">
<span
t-esc="account['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
</div>
<t t-if="not age_partner_config">
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 6.00%">
@@ -802,7 +804,7 @@
%
</div>
</t>
</t>
</t>
</div>
</div>
</template>

View File

@@ -492,8 +492,8 @@
t-if="int(line['analytic_distribution'][analytic_id]) &lt; 100"
>
<t
t-out="int(line['analytic_distribution'][analytic_id])"
/>%
t-out="int(line['analytic_distribution'][analytic_id])"
/>%
</t>
</span>
</div>

View File

@@ -105,7 +105,7 @@
</t>
</t>
<t t-else="">
<t t-if="not with_auto_sequence">
<t t-if="not with_auto_sequence">
<t t-set="account_column_style">
width: 23.78%;
</t>
@@ -198,12 +198,8 @@
</b>
</div>
<t t-if="display_currency">
<div class="act_as_cell" name="currency_name">
</div>
<div class="act_as_cell amount" name="amount_currency">
</div>
<div class="act_as_cell" name="currency_name" />
<div class="act_as_cell amount" name="amount_currency" />
</t>
</div>
<div style="width: 100%" />
@@ -256,8 +252,8 @@
<span t-if="display_account_name">
-
<span
t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'name')"
/>
t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'name')"
/>
</span>
</div>
<div class="act_as_cell left" name="partner">
@@ -443,77 +439,73 @@
<div class="act_as_table data_table" style="width: 100%;">
10
<div class="act_as_row labels">
<div
class="act_as_cell first_column"
name="name"
style="width: 30.97%;"
/>
<div class="act_as_cell" name="description" style="width: 13.27%;" />
<div class="act_as_cell" name="base_debit" style="width: 9.29%;">
<div class="act_as_cell first_column" name="name" style="width: 30.97%;" />
<div class="act_as_cell" name="description" style="width: 13.27%;" />
<div class="act_as_cell" name="base_debit" style="width: 9.29%;">
Debit
</div>
<div class="act_as_cell" name="base_credit" style="width: 9.29%;">
<div class="act_as_cell" name="base_credit" style="width: 9.29%;">
Credit
</div>
<div class="act_as_cell" name="base_balance" style="width: 9.29%;">
<div class="act_as_cell" name="base_balance" style="width: 9.29%;">
Balance
</div>
<div class="act_as_cell" name="tax_debit" style="width: 9.29%;">
<div class="act_as_cell" name="tax_debit" style="width: 9.29%;">
Debit
</div>
<div class="act_as_cell" name="tax_credit" style="width: 9.29%;">
<div class="act_as_cell" name="tax_credit" style="width: 9.29%;">
Credit
</div>
<div class="act_as_cell" name="tax_balance" style="width: 9.29%;">
<div class="act_as_cell" name="tax_balance" style="width: 9.29%;">
Balance
</div>
</div>
<t t-foreach="ReportTaxLines" t-as="tax_line">
<div class="act_as_row lines">
<div class="act_as_cell left" name="tax_name">
<span t-esc="tax_line['tax_name']" />
</div>
<div class="act_as_cell left" name="tax_code">
<span t-esc="tax_line['tax_code']" />
</div>
<div class="act_as_cell amount" name="base_debit">
<span
t-esc="tax_line['base_debit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="base_credit">
<span
t-esc="tax_line['base_credit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="base_balance">
<span
t-esc="tax_line['base_balance']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_debit">
<span
t-esc="tax_line['tax_debit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_credit">
<span
t-esc="tax_line['tax_credit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_balance">
<span
t-esc="tax_line['tax_balance']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
</div>
<t t-foreach="ReportTaxLines" t-as="tax_line">
<div class="act_as_row lines">
<div class="act_as_cell left" name="tax_name">
<span t-esc="tax_line['tax_name']" />
</div>
<div class="act_as_cell left" name="tax_code">
<span t-esc="tax_line['tax_code']" />
</div>
<div class="act_as_cell amount" name="base_debit">
<span
t-esc="tax_line['base_debit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="base_credit">
<span
t-esc="tax_line['base_credit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="base_balance">
<span
t-esc="tax_line['base_balance']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_debit">
<span
t-esc="tax_line['tax_debit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_credit">
<span
t-esc="tax_line['tax_credit']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
<div class="act_as_cell amount" name="tax_balance">
<span
t-esc="tax_line['tax_balance']"
t-options="{'widget': 'float', 'precision': 2}"
/>
</div>
</div>
</t>
</t>
</div>
</template>
</odoo>

View File

@@ -98,9 +98,7 @@
<t t-set="style" t-value="'font-size:12px;'" />
<!-- Different style for account group -->
<t t-if="show_hierarchy">
<t
t-if="balance['type'] == 'group_type'"
>
<t t-if="balance['type'] == 'group_type'">
<t
t-set="style"
t-value="style + 'font-weight: bold; color: blue;'"
@@ -143,8 +141,8 @@
view-type="form"
>
<t
t-out="accounts_data[account_id]['code']"
/> - <t t-out="accounts_data[account_id]['name']" />
t-out="accounts_data[account_id]['code']"
/> - <t t-out="accounts_data[account_id]['name']" />
</span>
</div>
<div class="act_as_table data_table" style="width: 100%;">

View File

@@ -266,9 +266,9 @@ class TrialBalanceReport(models.AbstractModel):
tb2 = tb["group_by_data"][gb_key]
if "group_by_data" in total_amount[acc_id]:
if gb_key not in total_amount[acc_id]["group_by_data"]:
total_amount[acc_id]["group_by_data"][
gb_key
] = self._prepare_total_amount(tb2, foreign_currency)
total_amount[acc_id]["group_by_data"][gb_key] = (
self._prepare_total_amount(tb2, foreign_currency)
)
else:
total_amount[acc_id]["group_by_data"][gb_key][
"initial_balance"
@@ -598,19 +598,19 @@ class TrialBalanceReport(models.AbstractModel):
total_amount[unaffected_id]["ending_balance"] += pl_initial_balance
total_amount[unaffected_id]["initial_balance"] += pl_initial_balance
if foreign_currency:
total_amount[unaffected_id][
"ending_currency_balance"
] += pl_initial_currency_balance
total_amount[unaffected_id][
"initial_currency_balance"
] += pl_initial_currency_balance
total_amount[unaffected_id]["ending_currency_balance"] += (
pl_initial_currency_balance
)
total_amount[unaffected_id]["initial_currency_balance"] += (
pl_initial_currency_balance
)
if grouped_by:
total_amount[unaffected_id]["group_by_data"][0][
"ending_balance"
] = total_amount[unaffected_id]["ending_balance"]
total_amount[unaffected_id]["group_by_data"][0][
"initial_balance"
] = total_amount[unaffected_id]["initial_balance"]
total_amount[unaffected_id]["group_by_data"][0]["ending_balance"] = (
total_amount[unaffected_id]["ending_balance"]
)
total_amount[unaffected_id]["group_by_data"][0]["initial_balance"] = (
total_amount[unaffected_id]["initial_balance"]
)
if foreign_currency:
total_amount[unaffected_id]["group_by_data"][0][
"ending_currency_balance"
@@ -833,12 +833,12 @@ class TrialBalanceReport(models.AbstractModel):
"ending_balance"
]
if foreign_currency:
groups_data[group_id][
"initial_currency_balance"
] += total_amount[acc_id]["initial_currency_balance"]
groups_data[group_id][
"ending_currency_balance"
] += total_amount[acc_id]["ending_currency_balance"]
groups_data[group_id]["initial_currency_balance"] += (
total_amount[acc_id]["initial_currency_balance"]
)
groups_data[group_id]["ending_currency_balance"] += (
total_amount[acc_id]["ending_currency_balance"]
)
return groups_data
def _get_report_values(self, docids, data):