oca-ocb-core/odoo-bringout-oca-ocb-payment/payment/tests/test_res_company.py
Ernad Husremovic 2d3ee4855a 19.0 vanilla
2026-03-09 09:30:27 +01:00

24 lines
954 B
Python

from odoo.tests import tagged
from odoo.addons.payment.tests.common import PaymentCommon
@tagged('-at_install', 'post_install')
class TestResCompany(PaymentCommon):
def test_creating_company_duplicates_providers(self):
"""Ensure that installed payment providers of an existing company are correctly duplicated
when a new company is created."""
main_company = self.env.company
main_company_providers_count = self.env['payment.provider'].search_count([
('company_id', '=', main_company.id),
('module_state', '=', 'installed'),
])
new_company = self.env['res.company'].create({'name': 'New Company'})
new_company_providers_count = self.env['payment.provider'].search_count([
('company_id', '=', new_company.id),
('module_state', '=', 'installed'),
])
self.assertEqual(new_company_providers_count, main_company_providers_count)