survey_custom_certificate_t.../__init__.py
2025-11-29 08:46:04 +07:00

44 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
from . import models
from . import wizards
from . import services
def post_init_hook(env):
"""
Post-installation hook to check LibreOffice availability.
This hook runs after the module is installed and checks if LibreOffice
is available on the system. If not, it logs a warning to notify
administrators that PDF conversion will not be available.
Args:
env: Odoo environment
"""
import logging
from .services.certificate_generator import CertificateGenerator
_logger = logging.getLogger(__name__)
_logger.info('Checking LibreOffice availability for Survey Custom Certificate Template module...')
# Check LibreOffice availability
is_available, error_message = CertificateGenerator.check_libreoffice_availability()
if is_available:
_logger.info(
'✓ LibreOffice is available. PDF certificate generation is enabled.'
)
else:
_logger.warning(
'✗ LibreOffice is not available. PDF certificate generation will not work.\n'
'Error: %s\n'
'To enable PDF conversion, please install LibreOffice:\n'
' - Ubuntu/Debian: sudo apt-get install libreoffice\n'
' - CentOS/RHEL: sudo yum install libreoffice\n'
' - macOS: brew install --cask libreoffice\n'
'After installation, restart the Odoo service.',
error_message
)