-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_br_account_withholding: tests for conversion Partner to WH
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_account_wh_invoice | ||
from . import test_l10n_br_account_wh_wizard |
30 changes: 30 additions & 0 deletions
30
l10n_br_account_withholding/tests/test_l10n_br_account_wh_wizard.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,30 @@ | ||
# Copyright (C) 2024 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.exceptions import UserError | ||
from odoo.tests.common import TransactionCase, tagged | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestAccountWHWizard(TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.Wizard = self.env["l10n_br_account.wh.wizard"] | ||
self.partner = self.env.ref("base.res_partner_1") | ||
self.partner2 = self.env.ref("base.res_partner_2") | ||
|
||
def test_action_convert_cityhall(self): | ||
self.Wizard.action_convert_cityhall(self.partner) | ||
self.assertTrue(self.partner.wh_cityhall) | ||
|
||
def test_action_reset_convert(self): | ||
wizard = self.Wizard.with_context( | ||
active_ids=[self.partner.id], wh_record_type="" | ||
) | ||
wizard.action_convert() | ||
self.assertFalse(self.partner.wh_cityhall) | ||
|
||
def test_action_convert_cityhall_duplicate(self): | ||
self.partner2.write({"city_id": self.partner.city_id.id, "wh_cityhall": True}) | ||
with self.assertRaises(UserError): | ||
self.Wizard.action_convert_cityhall(self.partner) |