68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
from . import models
|
|
|
|
|
|
def _post_init_hook(env):
|
|
"""
|
|
Set all configuration parameters to disable external Odoo services.
|
|
This runs after module installation.
|
|
"""
|
|
import logging
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
set_param = env['ir.config_parameter'].sudo().set_param
|
|
|
|
# Set permanent database expiration
|
|
params_to_set = {
|
|
# Database license parameters
|
|
'database.expiration_date': '2099-12-31 23:59:59',
|
|
'database.expiration_reason': 'renewal',
|
|
'database.enterprise_code': 'PERMANENT_LOCAL',
|
|
|
|
# Clear "already linked" parameters
|
|
'database.already_linked_subscription_url': '',
|
|
'database.already_linked_email': '',
|
|
'database.already_linked_send_mail_url': '',
|
|
|
|
# Redirect all IAP endpoints to localhost
|
|
'iap.endpoint': 'http://localhost:65535',
|
|
'partner_autocomplete.endpoint': 'http://localhost:65535',
|
|
'iap_extract_endpoint': 'http://localhost:65535',
|
|
'olg.endpoint': 'http://localhost:65535',
|
|
'mail.media_library_endpoint': 'http://localhost:65535',
|
|
'website.api_endpoint': 'http://localhost:65535',
|
|
'sms.endpoint': 'http://localhost:65535',
|
|
'crm.iap_lead_mining.endpoint': 'http://localhost:65535',
|
|
'reveal.endpoint': 'http://localhost:65535',
|
|
'publisher_warranty_url': 'http://localhost:65535',
|
|
|
|
# OCN (Odoo Cloud Notification) - blocks push notifications to Odoo
|
|
'odoo_ocn.endpoint': 'http://localhost:65535', # Main OCN endpoint
|
|
'mail_mobile.enable_ocn': 'False', # Disable OCN push notifications
|
|
'odoo_ocn.project_id': '', # Clear any registered project
|
|
'ocn.uuid': '', # Clear OCN UUID to prevent registration
|
|
|
|
# Snailmail (physical mail service)
|
|
'snailmail.endpoint': 'http://localhost:65535',
|
|
|
|
# Social media IAP
|
|
'social.facebook_endpoint': 'http://localhost:65535',
|
|
'social.twitter_endpoint': 'http://localhost:65535',
|
|
'social.linkedin_endpoint': 'http://localhost:65535',
|
|
}
|
|
|
|
_logger.info("=" * 60)
|
|
_logger.info("DISABLE ODOO ONLINE: Setting configuration parameters")
|
|
_logger.info("=" * 60)
|
|
|
|
for key, value in params_to_set.items():
|
|
try:
|
|
set_param(key, value)
|
|
_logger.info("Set %s = %s", key, value if len(str(value)) < 30 else value[:30] + "...")
|
|
except Exception as e:
|
|
_logger.warning("Could not set %s: %s", key, e)
|
|
|
|
_logger.info("=" * 60)
|
|
_logger.info("DISABLE ODOO ONLINE: Configuration complete")
|
|
_logger.info("=" * 60)
|