From ecf2022c106ea822042e2aa0aef90e99eae87a11 Mon Sep 17 00:00:00 2001 From: Jorge Che Date: Mon, 10 Oct 2022 00:33:21 +0000 Subject: [PATCH] [IMP] account_exception: added ignore exception on wizard H11044 --- .../tests/test_account_move_exception.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/account_exception/tests/test_account_move_exception.py b/account_exception/tests/test_account_move_exception.py index 22b6717d..77d72f99 100644 --- a/account_exception/tests/test_account_move_exception.py +++ b/account_exception/tests/test_account_move_exception.py @@ -1,7 +1,6 @@ -# from odoo.tests import common +from odoo.tests import Form from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo.tests import tagged -# from odoo.tests.common import Form @tagged('post_install', '-at_install') @@ -15,10 +14,25 @@ class TestAccountMoveException(AccountTestInvoicingCommon): # must be exceptions when no phone and posting invoice.partner_id.phone = False - invoice.action_post() + action = invoice.action_post() self.assertTrue(invoice.exception_ids) + self.assertEqual(invoice.state, 'draft') + + wizard_model = action.get('res_model', '') + self.assertEqual(wizard_model, 'account.move.exception.confirm') + wizard = Form(self.env[wizard_model].with_context(action['context'])).save() + self.assertFalse(wizard.show_ignore_button) + + # no exceptions when ignoring exceptions and posting + invoice.ignore_exception = True + invoice.action_post() + self.assertFalse(invoice.exception_ids) + self.assertEqual(invoice.state, 'posted') # no exceptions when phone and posting + invoice.button_draft() + invoice.ignore_exception = False invoice.partner_id.phone = '123' invoice.action_post() self.assertFalse(invoice.exception_ids) + self.assertEqual(invoice.state, 'posted')