details: https://code.tryton.org/tryton/commit/2376a541800e
branch: default
user: Cédric Krier <[email protected]>
date: Fri Oct 31 12:03:02 2025 +0100
description:
Add test to check replaced field of replace party wizard
diffstat:
modules/account/tests/test_module.py | 4 +-
modules/account_invoice/tests/test_module.py | 4 +-
modules/account_payment/tests/test_module.py | 4 +-
modules/account_payment_braintree/tests/test_module.py | 3 +-
modules/account_payment_sepa/tests/test_module.py | 4 +-
modules/account_payment_stripe/tests/test_module.py | 3 +-
modules/account_statement/tests/test_module.py | 4 +-
modules/bank/tests/test_module.py | 3 +-
modules/carrier/tests/test_module.py | 3 +-
modules/commission/tests/test_module.py | 4 +-
modules/company/tests/test_module.py | 6 ++-
modules/party/tests/__init__.py | 4 +-
modules/party/tests/test_module.py | 30 +++++++++++++++++-
modules/project/tests/test_module.py | 4 +-
modules/purchase/tests/test_module.py | 4 +-
modules/purchase_request/tests/test_module.py | 3 +-
modules/sale/tests/test_module.py | 4 +-
modules/sale_opportunity/tests/test_module.py | 4 +-
modules/sale_subscription/tests/test_module.py | 4 +-
modules/sale_supply_drop_shipment/tests/test_module.py | 4 +-
modules/stock/tests/test_module.py | 4 +-
modules/web_shop_shopify/tests/test_module.py | 3 +-
modules/web_user/tests/test_module.py | 6 ++-
23 files changed, 90 insertions(+), 26 deletions(-)
diffs (460 lines):
diff -r 101e1d87a261 -r 2376a541800e modules/account/tests/test_module.py
--- a/modules/account/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/account/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -13,6 +13,7 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
from trytond.modules.currency.tests import create_currency
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction, inactive_records
@@ -167,7 +168,8 @@
class AccountTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Account module'
module = 'account'
maxDiff = None
diff -r 101e1d87a261 -r 2376a541800e
modules/account_invoice/tests/test_module.py
--- a/modules/account_invoice/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/account_invoice/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -9,6 +9,7 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin)
from trytond.modules.currency.tests import create_currency
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
@@ -35,7 +36,8 @@
class AccountInvoiceTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test AccountInvoice module'
module = 'account_invoice'
diff -r 101e1d87a261 -r 2376a541800e
modules/account_payment/tests/test_module.py
--- a/modules/account_payment/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/account_payment/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -3,11 +3,13 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
class AccountPaymentTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Account Payment module'
module = 'account_payment'
extras = ['account_invoice', 'account_statement', 'account_statement_rule']
diff -r 101e1d87a261 -r 2376a541800e
modules/account_payment_braintree/tests/test_module.py
--- a/modules/account_payment_braintree/tests/test_module.py Fri Nov 28
12:06:48 2025 +0100
+++ b/modules/account_payment_braintree/tests/test_module.py Fri Oct 31
12:03:02 2025 +0100
@@ -1,10 +1,11 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
-class AccountPaymentBraintreeTestCase(ModuleTestCase):
+class AccountPaymentBraintreeTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Account Payment Braintree module'
module = 'account_payment_braintree'
diff -r 101e1d87a261 -r 2376a541800e
modules/account_payment_sepa/tests/test_module.py
--- a/modules/account_payment_sepa/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/account_payment_sepa/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -15,6 +15,7 @@
from trytond.modules.company.tests import (
CompanyTestMixin, create_company, set_company)
from trytond.modules.currency.tests import create_currency
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction
@@ -149,7 +150,8 @@
schema.assertValid(sepa_xml)
-class AccountPaymentSepaTestCase(CompanyTestMixin, ModuleTestCase):
+class AccountPaymentSepaTestCase(
+ PartyCheckReplaceMixin, CompanyTestMixin, ModuleTestCase):
'Test Account Payment SEPA module'
module = 'account_payment_sepa'
diff -r 101e1d87a261 -r 2376a541800e
modules/account_payment_stripe/tests/test_module.py
--- a/modules/account_payment_stripe/tests/test_module.py Fri Nov 28
12:06:48 2025 +0100
+++ b/modules/account_payment_stripe/tests/test_module.py Fri Oct 31
12:03:02 2025 +0100
@@ -1,10 +1,11 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
-class AccountPaymentStripeTestCase(ModuleTestCase):
+class AccountPaymentStripeTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Account Payment Stripe module'
module = 'account_payment_stripe'
diff -r 101e1d87a261 -r 2376a541800e
modules/account_statement/tests/test_module.py
--- a/modules/account_statement/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/account_statement/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -2,10 +2,12 @@
# this repository contains the full copyright notices and license terms.
from trytond.modules.company.tests import CompanyTestMixin
+from trytond.modules.party.tests import PartyCheckEraseMixin
from trytond.tests.test_tryton import ModuleTestCase
-class AccountStatementTestCase(CompanyTestMixin, ModuleTestCase):
+class AccountStatementTestCase(
+ CompanyTestMixin, PartyCheckEraseMixin, ModuleTestCase):
'Test AccountStatement module'
module = 'account_statement'
diff -r 101e1d87a261 -r 2376a541800e modules/bank/tests/test_module.py
--- a/modules/bank/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/bank/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -11,11 +11,12 @@
from trytond.model.exceptions import SQLConstraintError
from trytond.modules.bank.exceptions import InvalidBIC
from trytond.modules.currency.tests import create_currency
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
-class BankTestCase(ModuleTestCase):
+class BankTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Bank module'
module = 'bank'
diff -r 101e1d87a261 -r 2376a541800e modules/carrier/tests/test_module.py
--- a/modules/carrier/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/carrier/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -4,6 +4,7 @@
from decimal import Decimal
from trytond.modules.company.tests import create_company, set_company
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
@@ -35,7 +36,7 @@
return carrier
-class CarrierTestCase(ModuleTestCase):
+class CarrierTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Carrier module'
module = 'carrier'
diff -r 101e1d87a261 -r 2376a541800e modules/commission/tests/test_module.py
--- a/modules/commission/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/commission/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -5,6 +5,7 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
@@ -46,7 +47,8 @@
class CommissionTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Commission module'
module = 'commission'
extras = ['sale', 'stock', 'account_invoice_stock']
diff -r 101e1d87a261 -r 2376a541800e modules/company/tests/test_module.py
--- a/modules/company/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/company/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -10,7 +10,8 @@
from trytond.model import ModelStorage, ModelView
from trytond.modules.company.model import CompanyMultiValueMixin
from trytond.modules.currency.tests import add_currency_rate, create_currency
-from trytond.modules.party.tests import PartyCheckEraseMixin
+from trytond.modules.party.tests import (
+ PartyCheckEraseMixin, PartyCheckReplaceMixin)
from trytond.pool import Pool, isregisteredby
from trytond.pyson import Eval, PYSONEncoder
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
@@ -152,7 +153,8 @@
class CompanyTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Company module'
module = 'company'
diff -r 101e1d87a261 -r 2376a541800e modules/party/tests/__init__.py
--- a/modules/party/tests/__init__.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/party/tests/__init__.py Fri Oct 31 12:03:02 2025 +0100
@@ -1,6 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
-from .test_module import PartyCheckEraseMixin
+from .test_module import PartyCheckEraseMixin, PartyCheckReplaceMixin
-__all__ = ['PartyCheckEraseMixin']
+__all__ = [PartyCheckEraseMixin, PartyCheckReplaceMixin]
diff -r 101e1d87a261 -r 2376a541800e modules/party/tests/test_module.py
--- a/modules/party/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/party/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -16,6 +16,7 @@
IDENTIFIER_TYPES, IDENTIFIER_VAT, replace_vat)
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
+from trytond.tools import is_instance_method
from trytond.transaction import Transaction
@@ -43,7 +44,34 @@
return party
-class PartyTestCase(PartyCheckEraseMixin, ModuleTestCase):
+class PartyCheckReplaceMixin:
+
+ @with_transaction()
+ def test_check_replace_party(self):
+ "Test fields to replace"
+ pool = Pool()
+ Replace = pool.get('party.replace', type='wizard')
+
+ for model_name, field_name in Replace.fields_to_replace():
+ with self.subTest(model_name=model_name, field_name=field_name):
+ Model = pool.get(model_name)
+ field = getattr(Model, field_name)
+ if field._type == 'reference':
+ if isinstance(field.selection, (tuple, list)):
+ self.assertIn('party.party', dict(field.selection))
+ else:
+ sel_func = getattr(Model, field.selection)
+ instance_sel_func = is_instance_method(
+ Model, field.selection)
+ if not instance_sel_func:
+ self.assertIn('party.party', dict(sel_func()))
+ else:
+ self.assertEqual(field._type, 'many2one')
+ self.assertEqual(field.model_name, 'party.party')
+
+
+class PartyTestCase(
+ PartyCheckEraseMixin, PartyCheckReplaceMixin, ModuleTestCase):
'Test Party module'
module = 'party'
diff -r 101e1d87a261 -r 2376a541800e modules/project/tests/test_module.py
--- a/modules/project/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/project/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -4,13 +4,15 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction
class ProjectTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Project module'
module = 'project'
diff -r 101e1d87a261 -r 2376a541800e modules/purchase/tests/test_module.py
--- a/modules/purchase/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/purchase/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -7,13 +7,15 @@
from trytond.modules.account.tests import create_chart
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction
class PurchaseTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Purchase module'
module = 'purchase'
diff -r 101e1d87a261 -r 2376a541800e
modules/purchase_request/tests/test_module.py
--- a/modules/purchase_request/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/purchase_request/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -4,11 +4,12 @@
import datetime as dt
from trytond.modules.company.tests import create_company, set_company
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
-class PurchaseRequestTestCase(ModuleTestCase):
+class PurchaseRequestTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Purchase Request module'
module = 'purchase_request'
diff -r 101e1d87a261 -r 2376a541800e modules/sale/tests/test_module.py
--- a/modules/sale/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/sale/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -5,13 +5,15 @@
from trytond.modules.account.tests import create_chart
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction
class SaleTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Sale module'
module = 'sale'
diff -r 101e1d87a261 -r 2376a541800e
modules/sale_opportunity/tests/test_module.py
--- a/modules/sale_opportunity/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/sale_opportunity/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -2,10 +2,12 @@
# this repository contains the full copyright notices and license terms.
from trytond.modules.company.tests import CompanyTestMixin
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
-class SaleOpportunityTestCase(CompanyTestMixin, ModuleTestCase):
+class SaleOpportunityTestCase(
+ PartyCheckReplaceMixin, CompanyTestMixin, ModuleTestCase):
'Test SaleOpportunity module'
module = 'sale_opportunity'
diff -r 101e1d87a261 -r 2376a541800e
modules/sale_subscription/tests/test_module.py
--- a/modules/sale_subscription/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/sale_subscription/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -3,11 +3,13 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
class SaleSubscriptionTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Sale Subscription module'
module = 'sale_subscription'
diff -r 101e1d87a261 -r 2376a541800e
modules/sale_supply_drop_shipment/tests/test_module.py
--- a/modules/sale_supply_drop_shipment/tests/test_module.py Fri Nov 28
12:06:48 2025 +0100
+++ b/modules/sale_supply_drop_shipment/tests/test_module.py Fri Oct 31
12:03:02 2025 +0100
@@ -3,11 +3,13 @@
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
class SaleSupplyDropShipmentTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test SaleSupplyDropShipment module'
module = 'sale_supply_drop_shipment'
extras = ['sale_amendment', 'stock_split']
diff -r 101e1d87a261 -r 2376a541800e modules/stock/tests/test_module.py
--- a/modules/stock/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/stock/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -11,6 +11,7 @@
from trytond.model.exceptions import AccessError
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.modules.stock.exceptions import (
LocationValidationError, MoveOriginWarning, PeriodCloseError,
ProductStockWarning)
@@ -20,7 +21,8 @@
class StockTestCase(
- PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
+ PartyCompanyCheckEraseMixin, PartyCheckReplaceMixin, CompanyTestMixin,
+ ModuleTestCase):
'Test Stock module'
module = 'stock'
longMessage = True
diff -r 101e1d87a261 -r 2376a541800e
modules/web_shop_shopify/tests/test_module.py
--- a/modules/web_shop_shopify/tests/test_module.py Fri Nov 28 12:06:48
2025 +0100
+++ b/modules/web_shop_shopify/tests/test_module.py Fri Oct 31 12:03:02
2025 +0100
@@ -1,10 +1,11 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+from trytond.modules.party.tests import PartyCheckReplaceMixin
from trytond.tests.test_tryton import ModuleTestCase
-class WebShopShopifyTestCase(ModuleTestCase):
+class WebShopShopifyTestCase(PartyCheckReplaceMixin, ModuleTestCase):
'Test Web Shop Shopify module'
module = 'web_shop_shopify'
diff -r 101e1d87a261 -r 2376a541800e modules/web_user/tests/test_module.py
--- a/modules/web_user/tests/test_module.py Fri Nov 28 12:06:48 2025 +0100
+++ b/modules/web_user/tests/test_module.py Fri Oct 31 12:03:02 2025 +0100
@@ -4,7 +4,8 @@
from unittest.mock import patch
import trytond.config as config
-from trytond.modules.party.tests import PartyCheckEraseMixin
+from trytond.modules.party.tests import (
+ PartyCheckEraseMixin, PartyCheckReplaceMixin)
from trytond.modules.web_user import user as user_module
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
@@ -14,7 +15,8 @@
FROM = '[email protected]'
-class WebUserTestCase(PartyCheckEraseMixin, ModuleTestCase):
+class WebUserTestCase(
+ PartyCheckEraseMixin, PartyCheckReplaceMixin, ModuleTestCase):
'Test Web User module'
module = 'web_user'