[IMP] account_exception: added ignore exception on wizard

H11044
This commit is contained in:
Jorge Che
2022-10-10 00:33:21 +00:00
parent 3d00e18e03
commit ecf2022c10

View File

@@ -1,7 +1,6 @@
# from odoo.tests import common from odoo.tests import Form
from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged from odoo.tests import tagged
# from odoo.tests.common import Form
@tagged('post_install', '-at_install') @tagged('post_install', '-at_install')
@@ -15,10 +14,25 @@ class TestAccountMoveException(AccountTestInvoicingCommon):
# must be exceptions when no phone and posting # must be exceptions when no phone and posting
invoice.partner_id.phone = False invoice.partner_id.phone = False
invoice.action_post() action = invoice.action_post()
self.assertTrue(invoice.exception_ids) 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 # no exceptions when phone and posting
invoice.button_draft()
invoice.ignore_exception = False
invoice.partner_id.phone = '123' invoice.partner_id.phone = '123'
invoice.action_post() invoice.action_post()
self.assertFalse(invoice.exception_ids) self.assertFalse(invoice.exception_ids)
self.assertEqual(invoice.state, 'posted')