[IMP] account_financial_report: Hide values that have the same currency as the company currency
An amount_different_company_currency cell type is added to apply the following logic: - If the currency is the same as the company's currency, we will leave the value empty. - If the currency is different from the company's currency, we will show the value. TT38722pull/913/head
parent
5deb99d7ae
commit
e1a024f7de
|
@ -237,6 +237,22 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
for col_pos, column in report_data["columns"].items():
|
for col_pos, column in report_data["columns"].items():
|
||||||
value = line_dict.get(column["field"], False)
|
value = line_dict.get(column["field"], False)
|
||||||
cell_type = column.get("type", "string")
|
cell_type = column.get("type", "string")
|
||||||
|
# We will use a special cell type according to the currency of
|
||||||
|
# record and the company's currency:
|
||||||
|
# - If the currency is the same as the company's currency, we will leave
|
||||||
|
# the value empty.
|
||||||
|
# - If the currency is different from the company's currency, we will
|
||||||
|
# show the value.
|
||||||
|
if cell_type == "amount_different_company_currency":
|
||||||
|
if line_dict.get("currency_id") and line_dict.get(
|
||||||
|
"company_currency_id"
|
||||||
|
):
|
||||||
|
if line_dict["currency_id"] == line_dict["company_currency_id"]:
|
||||||
|
value = ""
|
||||||
|
cell_type = "string"
|
||||||
|
else:
|
||||||
|
cell_type = "amount_currency"
|
||||||
|
# All conditions according to cell type.
|
||||||
if cell_type == "string":
|
if cell_type == "string":
|
||||||
if (
|
if (
|
||||||
line_dict.get("account_group_id", False)
|
line_dict.get("account_group_id", False)
|
||||||
|
|
|
@ -78,13 +78,13 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"field": "bal_curr",
|
"field": "bal_curr",
|
||||||
"field_initial_balance": "initial_bal_curr",
|
"field_initial_balance": "initial_bal_curr",
|
||||||
"field_final_balance": "final_bal_curr",
|
"field_final_balance": "final_bal_curr",
|
||||||
"type": "amount_currency",
|
"type": "amount_different_company_currency",
|
||||||
"width": 10,
|
"width": 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": _("Cumul cur."),
|
"header": _("Cumul cur."),
|
||||||
"field": "total_bal_curr",
|
"field": "total_bal_curr",
|
||||||
"type": "amount_currency",
|
"type": "amount_different_company_currency",
|
||||||
"width": 10,
|
"width": 10,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -183,6 +183,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
{
|
{
|
||||||
"account": account["code"],
|
"account": account["code"],
|
||||||
"journal": journals_data[line["journal_id"]]["code"],
|
"journal": journals_data[line["journal_id"]]["code"],
|
||||||
|
"company_currency_id": company_currency.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if line["currency_id"]:
|
if line["currency_id"]:
|
||||||
|
@ -266,6 +267,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
{
|
{
|
||||||
"account": account["code"],
|
"account": account["code"],
|
||||||
"journal": journals_data[line["journal_id"]]["code"],
|
"journal": journals_data[line["journal_id"]]["code"],
|
||||||
|
"company_currency_id": company_currency.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if line["currency_id"]:
|
if line["currency_id"]:
|
||||||
|
|
|
@ -591,6 +591,7 @@
|
||||||
<t
|
<t
|
||||||
t-set="total_bal_curr"
|
t-set="total_bal_curr"
|
||||||
t-value="total_bal_curr + line['bal_curr']"
|
t-value="total_bal_curr + line['bal_curr']"
|
||||||
|
t-if="line_currency!=company_currency"
|
||||||
/>
|
/>
|
||||||
<!--## amount_currency-->
|
<!--## amount_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 3.63%;">
|
<div class="act_as_cell amount" style="width: 3.63%;">
|
||||||
|
@ -600,6 +601,7 @@
|
||||||
view-type="form"
|
view-type="form"
|
||||||
t-raw="line['bal_curr']"
|
t-raw="line['bal_curr']"
|
||||||
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
||||||
|
t-if="line_currency!=company_currency"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_currency cumulated-->
|
<!--## amount_currency cumulated-->
|
||||||
|
@ -610,6 +612,7 @@
|
||||||
view-type="form"
|
view-type="form"
|
||||||
t-raw="total_bal_curr"
|
t-raw="total_bal_curr"
|
||||||
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
||||||
|
t-if="line_currency!=company_currency"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
Loading…
Reference in New Issue