[IMP] account_financial_report: Remove amount_different_company_currency type from xlsx
parent
8302f513ec
commit
a85e0e686b
|
@ -78,6 +78,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
||||||
new_domain = self._get_new_move_lines_domain(
|
new_domain = self._get_new_move_lines_domain(
|
||||||
new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
|
new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
|
||||||
)
|
)
|
||||||
|
company_currency = self.env["res.company"].browse(company_id).currency_id
|
||||||
ml_fields = self._get_ml_fields()
|
ml_fields = self._get_ml_fields()
|
||||||
new_move_lines = self.env["account.move.line"].search_read(
|
new_move_lines = self.env["account.move.line"].search_read(
|
||||||
domain=new_domain, fields=ml_fields
|
domain=new_domain, fields=ml_fields
|
||||||
|
@ -89,6 +90,14 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
||||||
move_line["amount_residual"] += debit_amount[ml_id]
|
move_line["amount_residual"] += debit_amount[ml_id]
|
||||||
if ml_id in credit_ids:
|
if ml_id in credit_ids:
|
||||||
move_line["amount_residual"] -= credit_amount[ml_id]
|
move_line["amount_residual"] -= credit_amount[ml_id]
|
||||||
|
# Set amount_currency=0 to keep the same behaviour as in v13
|
||||||
|
# Conditions: if there is no curency_id defined or it is equal
|
||||||
|
# to the company's curency_id
|
||||||
|
if "amount_currency" in move_line and (
|
||||||
|
"currency_id" not in move_line
|
||||||
|
or move_line["currency_id"] == company_currency.id
|
||||||
|
):
|
||||||
|
move_line["amount_currency"] = 0
|
||||||
return move_lines
|
return move_lines
|
||||||
|
|
||||||
def _get_accounts_data(self, accounts_ids):
|
def _get_accounts_data(self, accounts_ids):
|
||||||
|
|
|
@ -237,22 +237,6 @@ 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)
|
||||||
|
|
|
@ -74,7 +74,7 @@ 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_different_company_currency",
|
"type": "amount_currency",
|
||||||
"width": 10,
|
"width": 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,6 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
analytic_data = res_data["analytic_data"]
|
analytic_data = res_data["analytic_data"]
|
||||||
filter_partner_ids = res_data["filter_partner_ids"]
|
filter_partner_ids = res_data["filter_partner_ids"]
|
||||||
foreign_currency = res_data["foreign_currency"]
|
foreign_currency = res_data["foreign_currency"]
|
||||||
company_currency = report.company_id.currency_id
|
|
||||||
# For each account
|
# For each account
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
# Write account title
|
# Write account title
|
||||||
|
@ -176,7 +175,6 @@ 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"]:
|
||||||
|
@ -209,11 +207,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"analytic_distribution": analytic_distribution,
|
"analytic_distribution": analytic_distribution,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (
|
if foreign_currency:
|
||||||
foreign_currency
|
|
||||||
and line["currency_id"]
|
|
||||||
and line["currency_id"] != company_currency.id
|
|
||||||
):
|
|
||||||
total_bal_curr += line["bal_curr"]
|
total_bal_curr += line["bal_curr"]
|
||||||
line.update({"total_bal_curr": total_bal_curr})
|
line.update({"total_bal_curr": total_bal_curr})
|
||||||
self.write_line_from_dict(line, report_data)
|
self.write_line_from_dict(line, report_data)
|
||||||
|
@ -270,7 +264,6 @@ 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"]:
|
||||||
|
@ -305,11 +298,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"analytic_distribution": analytic_distribution,
|
"analytic_distribution": analytic_distribution,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (
|
if foreign_currency:
|
||||||
foreign_currency
|
|
||||||
and line["currency_id"]
|
|
||||||
and line["currency_id"] != company_currency.id
|
|
||||||
):
|
|
||||||
total_bal_curr += line["bal_curr"]
|
total_bal_curr += line["bal_curr"]
|
||||||
line.update({"total_bal_curr": total_bal_curr})
|
line.update({"total_bal_curr": total_bal_curr})
|
||||||
self.write_line_from_dict(line, report_data)
|
self.write_line_from_dict(line, report_data)
|
||||||
|
|
Loading…
Reference in New Issue