diff --git a/open_workshop_base/migrations/18.0.1.0.4/post-migration.py b/open_workshop_base/migrations/18.0.1.0.4/post-migration.py index 18bf034..6e4e601 100644 --- a/open_workshop_base/migrations/18.0.1.0.4/post-migration.py +++ b/open_workshop_base/migrations/18.0.1.0.4/post-migration.py @@ -99,7 +99,8 @@ def migrate(cr, version): except Exception as e: _logger.error(f"Failed to migrate machine {m_id}: {e}") - # 3. Synchronisiere related fields von ows.machine nach maintenance.equipment + # 3. Synchronisiere related fields von ows.machine → maintenance.equipment + # Nötig weil related fields mit store=True nicht automatisch bei SQL-INSERT synchronisiert werden _logger.info("Synchronizing related fields (area_id, category) to maintenance.equipment...") cr.execute(""" diff --git a/open_workshop_base/models/ows_models.py b/open_workshop_base/models/ows_models.py index 93e88f5..15885fb 100644 --- a/open_workshop_base/models/ows_models.py +++ b/open_workshop_base/models/ows_models.py @@ -414,6 +414,7 @@ class MaintenanceEquipment(models.Model): ows_machine_id = fields.One2many('ows.machine', 'equipment_id', string='OWS Maschine', readonly=True) # OWS-Felder direkt auf Equipment (via related für einfache Bearbeitung) + # store=True für Performance beim Filtern/Suchen ows_category = fields.Selection( related='ows_machine_id.category', string='Sicherheitskategorie',