Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions account_financial_report/tests/test_age_report_configuration.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Copyright 2023 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import Command
from odoo.exceptions import ValidationError
from odoo.tests import common, tagged
from odoo.tests import tagged

from odoo.addons.base.tests.common import BaseCommon


@tagged("post_install", "-at_install")
class TestAccountAgeReportConfiguration(common.TransactionCase):
class TestAccountAgeReportConfiguration(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -16,9 +18,7 @@ def setUpClass(cls):
{
"name": "Intervals configuration",
"line_ids": [
(
0,
0,
Command.create(
{
"name": "1-30",
"inferior_limit": 30,
Expand Down
21 changes: 6 additions & 15 deletions account_financial_report/tests/test_aged_partner_balance.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
# Copyright 2021 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests import TransactionCase, tagged
from odoo import Command
from odoo.tests import tagged
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, test_reports

from odoo.addons.base.tests.common import BaseCommon


@tagged("post_install", "-at_install")
class TestAgedPartnerBalance(TransactionCase):
class TestAgedPartnerBalance(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.wizard_model = cls.env["aged.partner.balance.report.wizard"]
# Check that report is produced correctly
cls.wizard_with_line_details = cls.wizard_model.create(
Expand All @@ -40,9 +33,7 @@ def setUpClass(cls):
{
"name": "Intervals configuration",
"line_ids": [
(
0,
0,
Command.create(
{
"name": "1-30",
"inferior_limit": 30,
Expand Down
30 changes: 8 additions & 22 deletions account_financial_report/tests/test_general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,18 @@
import time
from datetime import date

from odoo import api, fields
from odoo import Command, api, fields
from odoo.tests import tagged
from odoo.tools import mute_logger

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)
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
def setUpClass(cls):
super().setUpClass()
cls.before_previous_fy_year = fields.Date.from_string("2014-05-05")
cls.previous_fy_date_start = fields.Date.from_string("2015-01-01")
cls.previous_fy_date_end = fields.Date.from_string("2015-12-31")
Expand Down Expand Up @@ -66,29 +57,23 @@ def _add_move(
"journal_id": journal.id,
"date": date,
"line_ids": [
(
0,
0,
Command.create(
{
"debit": receivable_debit,
"credit": receivable_credit,
"account_id": self.receivable_account.id,
"partner_id": partner.id,
},
),
(
0,
0,
Command.create(
{
"debit": income_debit,
"credit": income_credit,
"account_id": self.income_account.id,
"partner_id": partner.id,
},
),
(
0,
0,
Command.create(
{
"debit": unaffected_debit,
"credit": unaffected_credit,
Expand Down Expand Up @@ -687,6 +672,7 @@ def test_04_unaffected_account_balance_2_years(self):
self.assertEqual(unaffected_fin_balance["credit"], 1000)
self.assertEqual(unaffected_fin_balance["balance"], 500)

@mute_logger("odoo.models.unlink")
def test_partner_filter(self):
partner_1 = self.env.ref("base.res_partner_1")
partner_2 = self.env.ref("base.res_partner_2")
Expand Down
30 changes: 8 additions & 22 deletions account_financial_report/tests/test_journal_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dateutil.relativedelta import relativedelta

from odoo.fields import Date
from odoo.fields import Command, Date
from odoo.tests import tagged
from odoo.tests.common import Form

Expand All @@ -16,18 +16,8 @@
@tagged("post_install", "-at_install")
class TestJournalReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
def setUpClass(cls):
super().setUpClass()
cls.AccountObj = cls.env["account.account"]
cls.InvoiceObj = cls.env["account.move"]
cls.JournalObj = cls.env["account.journal"]
Expand Down Expand Up @@ -100,19 +90,15 @@ def _add_move(
"journal_id": journal.id,
"date": date,
"line_ids": [
(
0,
0,
Command.create(
{
"name": move_name,
"debit": receivable_debit,
"credit": receivable_credit,
"account_id": self.receivable_account.id,
},
),
(
0,
0,
Command.create(
{
"name": move_name,
"debit": income_debit,
Expand Down Expand Up @@ -173,7 +159,7 @@ def test_01_test_total(self):
"date_from": self.fy_date_start,
"date_to": self.fy_date_end,
"company_id": self.company.id,
"journal_ids": [(6, 0, self.journal_sale.ids)],
"journal_ids": [Command.set(self.journal_sale.ids)],
"move_target": "all",
}
)
Expand Down Expand Up @@ -234,7 +220,7 @@ def test_02_test_taxes_out_invoice(self):
"date_from": self.fy_date_start,
"date_to": self.fy_date_end,
"company_id": self.company.id,
"journal_ids": [(6, 0, self.journal_sale.ids)],
"journal_ids": [Command.set(self.journal_sale.ids)],
"move_target": "all",
}
)
Expand Down Expand Up @@ -272,7 +258,7 @@ def test_03_test_taxes_in_invoice(self):
"date_from": self.fy_date_start,
"date_to": self.fy_date_end,
"company_id": self.company.id,
"journal_ids": [(6, 0, self.journal_purchase.ids)],
"journal_ids": [Command.set(self.journal_purchase.ids)],
"move_target": "all",
}
)
Expand Down
16 changes: 2 additions & 14 deletions account_financial_report/tests/test_open_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests import tagged
from odoo.tools import mute_logger

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)
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)

@mute_logger("odoo.models.unlink")
def test_partner_filter(self):
partner_1 = self.env.ref("base.res_partner_1")
partner_2 = self.env.ref("base.res_partner_2")
Expand Down
59 changes: 14 additions & 45 deletions account_financial_report/tests/test_trial_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.fields import Command
from odoo.tests import tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
Expand All @@ -11,18 +12,8 @@
@tagged("post_install", "-at_install")
class TestTrialBalanceReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
def setUpClass(cls):
super().setUpClass()
# Remove previous account groups and related invoices to avoid conflicts
group_obj = cls.env["account.group"]
cls.group1 = group_obj.create({"code_prefix_start": "1", "name": "Group 1"})
Expand Down Expand Up @@ -120,49 +111,39 @@ def _add_move(
"journal_id": journal.id,
"date": date,
"line_ids": [
(
0,
0,
Command.create(
{
"debit": receivable_debit,
"credit": receivable_credit,
"partner_id": partner.id,
"account_id": self.account100.id,
},
),
(
0,
0,
Command.create(
{
"debit": income_debit,
"credit": income_credit,
"partner_id": partner.id,
"account_id": self.account200.id,
},
),
(
0,
0,
Command.create(
{
"debit": unaffected_debit,
"credit": unaffected_credit,
"partner_id": partner.id,
"account_id": self.account110.id,
},
),
(
0,
0,
Command.create(
{
"debit": receivable_debit,
"credit": receivable_credit,
"partner_id": partner.id,
"account_id": self.account300.id,
},
),
(
0,
0,
Command.create(
{
"debit": receivable_credit,
"credit": receivable_debit,
Expand Down Expand Up @@ -520,14 +501,10 @@ def test_04_undistributed_pl(self):
"journal_id": journal.id,
"date": self.previous_fy_date_end,
"line_ids": [
(
0,
0,
Command.create(
{"debit": 0.0, "credit": 1000.0, "account_id": self.account300.id},
),
(
0,
0,
Command.create(
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
),
],
Expand Down Expand Up @@ -574,14 +551,10 @@ def test_04_undistributed_pl(self):
"journal_id": journal.id,
"date": self.date_start,
"line_ids": [
(
0,
0,
Command.create(
{"debit": 0.0, "credit": 1000.0, "account_id": self.account300.id},
),
(
0,
0,
Command.create(
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
),
],
Expand Down Expand Up @@ -628,14 +601,10 @@ def test_04_undistributed_pl(self):
"journal_id": journal.id,
"date": self.date_start,
"line_ids": [
(
0,
0,
Command.create(
{"debit": 0.0, "credit": 1000.0, "account_id": self.account110.id},
),
(
0,
0,
Command.create(
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
),
],
Expand Down
Loading