[FIX] payment: tests requiring account_payment
Skip the payment_asiapay test verifying the reference computation with an invoice when account_payment is not installed. Also add a dedicated helper, using the variable in payment already storing whether the account_payment module is installed. closes odoo/odoo#103449 X-original-commit: f1fd1c9e484025782079fc18c152269aa1723ed5 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com> Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -228,3 +228,8 @@ class PaymentCommon(TransactionCase):
|
||||
self.fail(f"{func.__name__} should not raise error of class {exception_class.__name__}")
|
||||
except Exception:
|
||||
pass # Any exception whose class is not monitored is caught and ignored
|
||||
|
||||
def _skip_if_account_payment_is_not_installed(self):
|
||||
""" Skip current test if `account_payment` module is not installed. """
|
||||
if not self.account_payment_installed:
|
||||
self.skipTest("account_payment module is not installed")
|
||||
|
||||
@@ -25,6 +25,8 @@ class TestPaymentTransaction(AsiaPayCommon, PaymentHttpCommon):
|
||||
@freeze_time('2011-11-02 12:00:21') # Freeze time for consistent singularization behavior.
|
||||
def test_reference_is_computed_based_on_document_name(self):
|
||||
""" Test the computation of reference prefixes based on the provided invoice. """
|
||||
self._skip_if_account_payment_is_not_installed()
|
||||
|
||||
invoice = self.env['account.move'].create({})
|
||||
reference = self.env['payment.transaction']._compute_reference(
|
||||
self.asiapay.code, invoice_ids=[Command.set([invoice.id])]
|
||||
|
||||
@@ -45,8 +45,7 @@ class OgoneTest(OgoneCommon, PaymentHttpCommon):
|
||||
@freeze_time('2011-11-02 12:00:21') # Freeze time for consistent singularization behavior
|
||||
def test_reference_is_computed_based_on_document_name(self):
|
||||
""" Test computation of reference prefixes based on the provided invoice. """
|
||||
if not self.env['ir.module.module']._get('account').state == 'installed':
|
||||
self.skipTest('account module not installed')
|
||||
self._skip_if_account_payment_is_not_installed()
|
||||
|
||||
invoice = self.env['account.move'].create({})
|
||||
reference = self.env['payment.transaction']._compute_reference(
|
||||
|
||||
@@ -46,8 +46,7 @@ class PayULatamTest(PayULatamCommon, PaymentHttpCommon):
|
||||
@freeze_time('2011-11-02 12:00:21') # Freeze time for consistent singularization behavior
|
||||
def test_reference_is_computed_based_on_document_name(self):
|
||||
""" Test computation of reference prefixes based on the provided invoice. """
|
||||
if not self.env['ir.module.module']._get('account').state == 'installed':
|
||||
self.skipTest('account module not installed')
|
||||
self._skip_if_account_payment_is_not_installed()
|
||||
|
||||
invoice = self.env['account.move'].create({})
|
||||
reference = self.env['payment.transaction']._compute_reference(
|
||||
|
||||
Reference in New Issue
Block a user