[MIG] account_financial_report: Migration to 16.0
This commit is contained in:
@@ -25,7 +25,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", True),
|
||||
("include_initial_balance", "=", True),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -43,7 +43,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_initial_balances_pl_ml_domain(
|
||||
@@ -59,7 +65,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -77,7 +83,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
@api.model
|
||||
@@ -93,7 +105,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
show_partner_details,
|
||||
):
|
||||
domain = [
|
||||
("display_type", "=", False),
|
||||
("display_type", "not in", ["line_note", "line_section"]),
|
||||
("date", ">=", date_from),
|
||||
("date", "<=", date_to),
|
||||
]
|
||||
@@ -110,7 +122,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_initial_balance_fy_pl_ml_domain(
|
||||
@@ -125,7 +143,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -143,7 +161,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_pl_initial_balance(
|
||||
@@ -168,7 +192,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
initial_balances = self.env["account.move.line"].read_group(
|
||||
domain=domain,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
pl_initial_balance = 0.0
|
||||
@@ -367,7 +391,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_initial_acc_bs = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_bs,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
initial_domain_pl = self._get_initial_balances_pl_ml_domain(
|
||||
@@ -382,7 +406,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_initial_acc_pl = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_pl,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
tb_initial_acc_rg = tb_initial_acc_bs + tb_initial_acc_pl
|
||||
@@ -412,20 +436,20 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_period_acc = self.env["account.move.line"].read_group(
|
||||
domain=period_domain,
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency"],
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
|
||||
if show_partner_details:
|
||||
tb_initial_prt_bs = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_bs,
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id", "partner_id"],
|
||||
lazy=False,
|
||||
)
|
||||
tb_initial_prt_pl = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_pl,
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id", "partner_id"],
|
||||
)
|
||||
tb_initial_prt = tb_initial_prt_bs + tb_initial_prt_pl
|
||||
@@ -439,7 +463,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
"debit",
|
||||
"credit",
|
||||
"balance",
|
||||
"amount_currency",
|
||||
"amount_currency:sum",
|
||||
],
|
||||
groupby=["account_id", "partner_id"],
|
||||
lazy=False,
|
||||
|
||||
Reference in New Issue
Block a user