[MIG] account_financial_report: Migration to 16.0

This commit is contained in:
David Ramia
2022-12-20 14:25:50 +01:00
committed by chaule97
parent 0e20eeb133
commit 4de4c3d2b1
23 changed files with 289 additions and 318 deletions

View File

@@ -43,7 +43,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
"If partners are filtered, "
"debits and credits totals will not match the trial balance.",
)
show_analytic_tags = fields.Boolean()
receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many(
@@ -51,9 +50,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
string="Filter partners",
default=lambda self: self._default_partners(),
)
analytic_tag_ids = fields.Many2many(
comodel_name="account.analytic.tag", string="Filter analytic tags"
)
account_journal_ids = fields.Many2many(
comodel_name="account.journal", string="Filter journals"
)
@@ -148,10 +144,9 @@ class GeneralLedgerReportWizard(models.TransientModel):
@api.onchange("company_id")
def onchange_company_id(self):
"""Handle company change."""
account_type = self.env.ref("account.data_unaffected_earnings")
count = self.env["account.account"].search_count(
[
("user_type_id", "=", account_type.id),
("account_type", "=", "equity_unaffected"),
("company_id", "=", self.company_id.id),
]
)
@@ -236,11 +231,13 @@ class GeneralLedgerReportWizard(models.TransientModel):
if self.receivable_accounts_only or self.payable_accounts_only:
domain = [("company_id", "=", self.company_id.id)]
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [("internal_type", "in", ("receivable", "payable"))]
domain += [
("account_type", "in", ("asset_receivable", "liability_payable"))
]
elif self.receivable_accounts_only:
domain += [("internal_type", "=", "receivable")]
domain += [("account_type", "=", "asset_receivable")]
elif self.payable_accounts_only:
domain += [("internal_type", "=", "payable")]
domain += [("account_type", "=", "liability_payable")]
self.account_ids = self.env["account.account"].search(domain)
else:
self.account_ids = None
@@ -255,11 +252,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
@api.depends("company_id")
def _compute_unaffected_earnings_account(self):
account_type = self.env.ref("account.data_unaffected_earnings")
for record in self:
record.unaffected_earnings_account = self.env["account.account"].search(
[
("user_type_id", "=", account_type.id),
("account_type", "=", "equity_unaffected"),
("company_id", "=", record.company_id.id),
]
)
@@ -295,14 +291,12 @@ class GeneralLedgerReportWizard(models.TransientModel):
"only_posted_moves": self.target_move == "posted",
"hide_account_at_0": self.hide_account_at_0,
"foreign_currency": self.foreign_currency,
"show_analytic_tags": self.show_analytic_tags,
"company_id": self.company_id.id,
"account_ids": self.account_ids.ids,
"partner_ids": self.partner_ids.ids,
"grouped_by": self.grouped_by,
"cost_center_ids": self.cost_center_ids.ids,
"show_cost_center": self.show_cost_center,
"analytic_tag_ids": self.analytic_tag_ids.ids,
"journal_ids": self.account_journal_ids.ids,
"centralize": self.centralize,
"fy_start_date": self.fy_start_date,