Skip to content

Commit

Permalink
[IMP] l10n_br_account_withholding: tests for conversion Partner to WH
Browse files Browse the repository at this point in the history
  • Loading branch information
kaynnan committed Jul 17, 2024
1 parent 97e8748 commit 6eb098a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions l10n_br_account_withholding/tests/__init__.py
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
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)

0 comments on commit 6eb098a

Please sign in to comment.