Skip to content

Commit

Permalink
wippp
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Aug 8, 2024
1 parent c622e81 commit 09d0072
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 69 deletions.
4 changes: 2 additions & 2 deletions fiscal_company_account/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from . import test_tax_filtered
# from . import test_decorator
from . import test_mixin_change_filtered
from . import test_mixin_change_search_domain
56 changes: 0 additions & 56 deletions fiscal_company_account/tests/test_decorator.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase
from odoo.addons.fiscal_company_base.tests.test_abstract import TestAbstract


class TestTaxFiltered(TransactionCase):
"""Tests for Account Fiscal Company Module (Tax filter)"""

def setUp(self):
super().setUp()
self.taxes = self.env.ref("fiscal_company_account.sale_tax_20") | self.env.ref(
class TestMixinChangeFiltered(TestAbstract):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.taxes = cls.env.ref("fiscal_company_account.sale_tax_20") | cls.env.ref(
"fiscal_company_account.purchase_tax_20"
)
self.child_company = self.env.ref("fiscal_company_base.company_fiscal_child_1")
self.mother_company = self.env.ref("fiscal_company_base.company_fiscal_mother")

# Test Section
def test_01_filter_company(self):
Expand Down Expand Up @@ -71,7 +68,7 @@ def test_01_filter_company(self):
len(filtered_taxes), 0, "Filtering taxes by name should worker (3/3"
)

def test_that_should_fail(self):
def test_02_filter_company_that_should_fail(self):
# we test multiple filter in the same time.
# The non company condition will not be applyed (and should be).
# It is a limitation of the current implementation.
Expand Down
40 changes: 40 additions & 0 deletions fiscal_company_account/tests/test_mixin_change_search_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo.addons.fiscal_company_base.tests.test_abstract import TestAbstract


class TestMixinChangeSearchDomain(TestAbstract):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user_accountant.company_id = cls.child_company.id
cls.AccountAccount = cls.env["account.account"].with_user(cls.user_accountant)
cls.AccountJournal = cls.env["account.journal"].with_user(cls.user_accountant)

# Test Section
def test_01_mixin_change_search_domain_account_account(self):
"""Searching an account in a child company should return
accounts of the mother company"""
res = self.AccountAccount.search([("company_id", "=", self.mother_company.id)])
self.assertNotEqual(
len(res),
0,
"Searching accounts in a fiscal child company should return"
" accounts of the mother company",
)

def test_02_mixin_change_search_domain_account_journal(self):
"""Searching a journal in a child company should return
journals of the mother company"""
self.user_accountant.company_id = self.child_company.id
res = self.AccountJournal.search([("company_id", "=", self.mother_company.id)])
self.assertNotEqual(
len(res),
0,
"Searching accounts in a fiscal child company should return"
" accounts of the mother company",
)
2 changes: 1 addition & 1 deletion fiscal_company_base/tests/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class TestAbstract(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()

cls.ResCompany = cls.env["res.company"]
cls.group_company = cls.env.ref("fiscal_company_base.company_group")
cls.mother_company = cls.env.ref("fiscal_company_base.company_fiscal_mother")
cls.child_company = cls.env.ref("fiscal_company_base.company_fiscal_child_1")
cls.normal_company = cls.env.ref("base.main_company")
cls.user_accountant = cls.env.ref("fiscal_company_base.user_accountant")

0 comments on commit 09d0072

Please sign in to comment.