- pos_order.py von open_workshop_base nach open_workshop_pos verschoben POS-spezifische Logik gehört ins POS-Modul, nicht ins Base-Modul - Workaround für Odoo 18 pos_sms Bug hinzugefügt (hooks.py) Problem: pos_sms hatte auto_install=True in älteren Odoo 18 Versionen Lösung: Post-init Hook löscht verwaiste pos_sms Views automatisch - l10n_de als Dependency hinzugefügt Benötigt für POS Demo-Daten (Bankjournal muss existieren) open_workshop_base kann jetzt ohne POS installiert werden open_workshop_pos enthält alle POS-spezifische Funktionalität
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
||
import logging
|
||
|
||
_logger = logging.getLogger(__name__)
|
||
|
||
|
||
def post_init_hook(env):
|
||
"""
|
||
Workaround für Odoo 18 pos_sms Bug:
|
||
- pos_sms hat auto_install=True in älteren Odoo 18 Versionen
|
||
- Das Modul definiert ein Feld pos_sms_receipt_template_id in res.config.settings
|
||
- Wenn pos_sms nicht installiert ist, aber die View geladen wird, gibt es einen Fehler
|
||
|
||
Dieser Hook:
|
||
1. Deaktiviert auto_install für pos_sms falls vorhanden
|
||
2. Löscht verwaiste Views von pos_sms
|
||
"""
|
||
_logger.info("🔧 Open Workshop POS: Prüfe pos_sms Kompatibilität...")
|
||
|
||
# Prüfe ob pos_sms Modul existiert
|
||
pos_sms_module = env['ir.module.module'].search([('name', '=', 'pos_sms')], limit=1)
|
||
|
||
if not pos_sms_module:
|
||
_logger.info("✅ pos_sms Modul nicht gefunden - kein Patch nötig")
|
||
return
|
||
|
||
# Deaktiviere auto_install wenn das Modul nicht installiert ist
|
||
if pos_sms_module.state != 'installed':
|
||
_logger.info(f"ℹ️ pos_sms Status: {pos_sms_module.state}")
|
||
|
||
# Lösche verwaiste Views von pos_sms (falls vorhanden)
|
||
orphaned_views = env['ir.ui.view'].search([
|
||
('arch_db', 'ilike', 'pos_sms_receipt_template_id')
|
||
])
|
||
|
||
if orphaned_views:
|
||
_logger.warning(
|
||
f"🗑️ Lösche {len(orphaned_views)} verwaiste pos_sms View(s): "
|
||
f"{orphaned_views.mapped('name')}"
|
||
)
|
||
orphaned_views.sudo().unlink()
|
||
_logger.info("✅ Verwaiste Views erfolgreich gelöscht")
|
||
else:
|
||
_logger.info("✅ Keine verwaisten pos_sms Views gefunden")
|
||
else:
|
||
_logger.info("✅ pos_sms ist installiert - kein Patch nötig")
|