fix: POS-Funktionalität in open_workshop_pos verschoben + Workarounds

- 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
This commit is contained in:
Matthias Lotz 2026-01-28 18:55:55 +01:00
parent dfb77411d9
commit 7f827cf7eb
5 changed files with 50 additions and 1 deletions

View File

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from . import models
from .hooks import post_init_hook

View File

@ -27,6 +27,7 @@ Autor: HobbyHimmel
'depends': [
'open_workshop_base',
'point_of_sale',
'l10n_de', # Kontenplan für Deutschland (erstellt Bankjournal für POS Demo-Daten)
],
'data': [
# Views
@ -62,4 +63,5 @@ Autor: HobbyHimmel
'installable': True,
'application': False,
'auto_install': False,
'post_init_hook': 'post_init_hook',
}

View File

@ -0,0 +1,46 @@
# -*- 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")

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
# POS-spezifische Modelle (falls benötigt)
from . import pos_order