mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] account_exception: make it work on write and specific states
H11044
This commit is contained in:
1
account_exception/tests/__init__.py
Normal file
1
account_exception/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_account_move_exception
|
||||
24
account_exception/tests/test_account_move_exception.py
Normal file
24
account_exception/tests/test_account_move_exception.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# from odoo.tests import common
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestAccountMoveException(AccountTestInvoicingCommon):
|
||||
|
||||
def test_10_validation_on_write(self):
|
||||
self.env.user.groups_id += self.env.ref('analytic.group_analytic_accounting')
|
||||
exception = self.env.ref('account_exception.excep_no_phone').sudo()
|
||||
exception.active = True
|
||||
invoice = self.init_invoice('out_invoice', products=self.product_a)
|
||||
|
||||
# must be exceptions when no phone and posting
|
||||
invoice.partner_id.phone = False
|
||||
invoice.action_post()
|
||||
self.assertTrue(invoice.exception_ids)
|
||||
|
||||
# no exceptions when phone and posting
|
||||
invoice.partner_id.phone = '123'
|
||||
invoice.action_post()
|
||||
self.assertTrue(invoice.exception_ids)
|
||||
self.assertTrue(invoice.state='posted')
|
||||
Reference in New Issue
Block a user