-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09d0072
commit 06a65da
Showing
9 changed files
with
102 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
* For the migration to V>12, take care of the tax.filtered occurences in | ||
Odoo and OCA modules. | ||
There are a lot of ``filtered(lambda x: x.company_id == current_company)`` | ||
in Odoo. The module ``fiscal_company_account`` alter the behaviour of the function | ||
``filtered`` of the ``account.tax`` module, to filter on the mother fiscal company. | ||
However, the changes is imperfect, and multiple filters (company and not company filters) | ||
will fail. | ||
During migration, please run: | ||
``rgrep "tax.*filtered.*company_id"`` | ||
For the migration, take care of the tax.filtered occurences in Odoo and OCA modules. | ||
There are a lot of ``filtered(lambda x: x.company_id == current_company)`` | ||
in Odoo. The module ``fiscal_company_account`` alter the behaviour of the function | ||
``filtered`` of the ``account.tax`` module, to filter on the mother fiscal company. | ||
However, the changes is imperfect, and multiple filters (company and not company filters) | ||
will fail. | ||
|
||
During migration, please run: | ||
``rgrep "tax.*filtered.*company_id"`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import test_account_journal_dashboard | ||
from . import test_mixin_change_filtered | ||
from . import test_mixin_change_search_domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) | ||
# @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 import test_abstract | ||
|
||
|
||
class TestAbstract(test_abstract.TestAbstract): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.AccountAccount = cls.env["account.account"] | ||
cls.ProductProduct = cls.env["product.product"] | ||
cls.AccountMove = cls.env["account.move"] | ||
cls.AccountJournal = cls.env["account.journal"] |
62 changes: 62 additions & 0 deletions
62
fiscal_company_account/tests/test_account_journal_dashboard.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import json | ||
|
||
from odoo import Command | ||
|
||
from .test_abstract import TestAbstract | ||
|
||
|
||
class TestAccountJournalDashboard(TestAbstract): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.user_accountant.company_id = cls.child_company | ||
|
||
move_vals = { | ||
"partner_id": cls.ResPartner.with_user(cls.user_accountant) | ||
.search([])[0] | ||
.id, | ||
"move_type": "out_invoice", | ||
"line_ids": [ | ||
Command.create( | ||
{ | ||
"product_id": cls.ProductProduct.with_user(cls.user_accountant) | ||
.search([])[0] | ||
.id | ||
} | ||
) | ||
], | ||
} | ||
cls.move1 = cls.AccountMove.with_user(cls.user_accountant).create(move_vals) | ||
cls.move2 = cls.AccountMove.with_user(cls.user_accountant).create(move_vals) | ||
cls.move3 = cls.AccountMove.with_user(cls.user_accountant).create(move_vals) | ||
(cls.move1 | cls.move2).action_post() | ||
|
||
def test_01_dashboard_in_fiscal_child(self): | ||
self.user_accountant.company_id = self.child_company | ||
sale_journal = self.AccountJournal.with_user(self.user_accountant).search( | ||
[("type", "=", "sale")] | ||
) | ||
res = json.loads(sale_journal.kanban_dashboard) | ||
self.assertEqual(res.get("number_draft"), 1) | ||
self.assertEqual(res.get("number_waiting"), 2) | ||
self.assertEqual(res.get("entries_count"), 3) | ||
|
||
res = json.loads(sale_journal.kanban_dashboard_graph) | ||
self.assertEqual(len(res[0].get("values")), 0) | ||
|
||
def test_02_dashboard_in_fiscal_mother(self): | ||
self.user_accountant.company_id = self.mother_company | ||
sale_journal = self.AccountJournal.with_user(self.user_accountant).search( | ||
[("type", "=", "sale")] | ||
) | ||
res = json.loads(sale_journal.kanban_dashboard) | ||
self.assertEqual(res.get("number_draft"), 0) | ||
self.assertEqual(res.get("number_waiting"), 0) | ||
self.assertEqual(res.get("entries_count"), 0) | ||
|
||
res = json.loads(sale_journal.kanban_dashboard_graph) | ||
self.assertEqual(len(res[0].get("values")), 6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters