[MIG] account_financial_report: Migration to 18.0

This commit is contained in:
chaule97
2024-11-18 16:48:37 +07:00
parent c46e83a4a4
commit 01f22b8256
43 changed files with 292 additions and 220 deletions

View File

@@ -1,4 +1,4 @@
# ?? 2016 Julien Coux (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import test_aged_partner_balance

View File

@@ -15,8 +15,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestGeneralLedgerReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -42,7 +42,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
"=",
"equity_unaffected",
),
("company_id", "=", cls.env.user.company_id.id),
("company_ids", "in", [cls.env.user.company_id.id]),
],
limit=1,
)

View File

@@ -7,8 +7,7 @@ from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.fields import Date
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -16,8 +15,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestJournalReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,

View File

@@ -10,8 +10,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestOpenItems(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,

View File

@@ -3,6 +3,8 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
from odoo.tests import tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -11,8 +13,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestTrialBalanceReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -69,11 +71,11 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
"account_type": "income_other",
},
)
cls.account301 = cls._create_account_account(
cls.account201 = cls._create_account_account(
cls,
{
"code": "301",
"name": "Account 301",
"code": "201",
"name": "Account 201",
"group_id": cls.group2.id,
"account_type": "income_other",
},
@@ -167,7 +169,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
"debit": receivable_credit,
"credit": receivable_debit,
"partner_id": partner.id,
"account_id": self.account301.id,
"account_id": self.account201.id,
},
),
],
@@ -686,8 +688,13 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
self.assertEqual(total_debit, total_credit)
def test_05_all_accounts_loaded(self):
# Tests if all accounts are loaded when the account_code_ fields changed
all_accounts = self.env["account.account"].search([], order="code")
# Tests if all accounts which code is number are loaded
# when the account_code_ fields changed
all_accounts = (
self.env["account.account"]
.search([], order="code")
.filtered(lambda acc: re.fullmatch(r"[0-9]+(\.[0-9]+)?", acc.code))
)
company = self.env.user.company_id
trial_balance = self.env["trial.balance.report.wizard"].create(
{

View File

@@ -6,8 +6,7 @@ import time
from datetime import date
from odoo import fields
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -47,8 +46,8 @@ class TestVATReport(AccountTestInvoicingCommon):
return rslt
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -68,7 +67,7 @@ class TestVATReport(AccountTestInvoicingCommon):
cls.expense_account = cls.company_data["default_account_expense"]
cls.tax_account = cls.env["account.account"].search(
[
("company_id", "=", cls.company.id),
("company_ids", "in", [cls.company.id]),
(
"account_type",
"=",