remove test migration script
This commit is contained in:
parent
6121c52852
commit
b5c597add6
|
|
@ -1,122 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test runner for migrated modules
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, '/Volumes/Work/odoo_work/odoo-18.0')
|
||||
os.environ['ODOO_RC'] = '/Volumes/Work/odoo_work/odoo-18.0/debian/odoo.conf'
|
||||
|
||||
import odoo
|
||||
from odoo import registry
|
||||
|
||||
def test_modules():
|
||||
"""Test both migrated modules"""
|
||||
|
||||
# Initialize Odoo
|
||||
config = odoo.tools.config
|
||||
config.parse_config(['--config=/Volumes/Work/odoo_work/odoo-18.0/debian/odoo.conf'])
|
||||
|
||||
db_name = 'odoo18'
|
||||
|
||||
print("="*60)
|
||||
print("Testing Migrated Modules: hide_contacts & disable_quick_create")
|
||||
print("="*60)
|
||||
|
||||
try:
|
||||
reg = registry(db_name)
|
||||
|
||||
print("\n✓ Connected to database:", db_name)
|
||||
|
||||
# Check if modules are installed
|
||||
with reg.cursor() as cr:
|
||||
cr.execute("""
|
||||
SELECT name, state FROM ir_module_module
|
||||
WHERE name IN ('hide_contacts', 'disable_quick_create')
|
||||
""")
|
||||
modules = cr.fetchall()
|
||||
|
||||
print("\nModule Status:")
|
||||
for mod_name, state in modules:
|
||||
print(f" - {mod_name}: {state}")
|
||||
|
||||
with reg.cursor() as cr:
|
||||
env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
|
||||
|
||||
# Test hide_contacts module
|
||||
print("\n" + "="*40)
|
||||
print("Testing hide_contacts module")
|
||||
print("="*40)
|
||||
|
||||
try:
|
||||
group = env.ref('hide_contacts.group_show_contact_module')
|
||||
print(f"✓ Group exists: {group.name}")
|
||||
|
||||
menu = env.ref('contacts.menu_contacts')
|
||||
print(f"✓ Contacts menu found: {menu.name}")
|
||||
|
||||
if group.id in menu.groups_id.ids:
|
||||
print("✓ Menu has correct group restriction")
|
||||
else:
|
||||
print("✗ Menu group restriction not applied")
|
||||
|
||||
print("✓ hide_contacts module is working correctly")
|
||||
|
||||
except Exception as e:
|
||||
print(f"✗ Error testing hide_contacts: {e}")
|
||||
|
||||
# Test disable_quick_create module
|
||||
print("\n" + "="*40)
|
||||
print("Testing disable_quick_create module")
|
||||
print("="*40)
|
||||
|
||||
try:
|
||||
partner_model = env['ir.model'].search([('model', '=', 'res.partner')])
|
||||
if partner_model:
|
||||
print(f"✓ Partner model found: {partner_model.name}")
|
||||
|
||||
# Test the disable_create_edit field
|
||||
if hasattr(partner_model, 'disable_create_edit'):
|
||||
print("✓ disable_create_edit field exists")
|
||||
|
||||
# Test setting the field
|
||||
original_value = partner_model.disable_create_edit
|
||||
partner_model.disable_create_edit = True
|
||||
print("✓ Can set disable_create_edit to True")
|
||||
|
||||
# Search for disabled models
|
||||
disabled_models = env['ir.model'].search([
|
||||
('disable_create_edit', '=', True)
|
||||
])
|
||||
|
||||
if len(disabled_models) >= 1:
|
||||
print(f"✓ Found {len(disabled_models)} disabled model(s)")
|
||||
else:
|
||||
print("✗ No disabled models found")
|
||||
|
||||
# Restore original value
|
||||
partner_model.disable_create_edit = original_value
|
||||
|
||||
print("✓ disable_quick_create module is working correctly")
|
||||
else:
|
||||
print("✗ disable_create_edit field not found")
|
||||
else:
|
||||
print("✗ Partner model not found")
|
||||
|
||||
except Exception as e:
|
||||
print(f"✗ Error testing disable_quick_create: {e}")
|
||||
|
||||
print("\n" + "="*60)
|
||||
print("Module Testing Completed Successfully!")
|
||||
print("="*60)
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n✗ Error during testing: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_modules()
|
||||
Loading…
Reference in New Issue