From 09f28c8070b77fdb99c46d1fe0de523576c29c2b Mon Sep 17 00:00:00 2001 From: "matthias.lotz" Date: Wed, 7 Jan 2026 12:37:34 +0100 Subject: [PATCH] DokuWiki: Fix partner_ref sync und Template-Cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - partner_ref zu sync_fields hinzugefügt für automatische Synchronisation - action_clear_template_cache() Methode hinzugefügt zum manuellen Leeren des Caches - Template-Cache-Leeren Button im Wiki-Sync Wizard - Debug-Logging für partner_ref Wert Fixes: partner_ref wurde nicht automatisch synchronisiert und Template-Änderungen erforderten Server-Neustart --- .../models/maintenance_equipment.py | 34 ++++++++++++++++++- .../wizard/equipment_wiki_sync_wizard.py | 6 ++++ .../equipment_wiki_sync_wizard_views.xml | 6 ++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/open_workshop_dokuwiki/models/maintenance_equipment.py b/open_workshop_dokuwiki/models/maintenance_equipment.py index 684f8ac..b90b9b0 100644 --- a/open_workshop_dokuwiki/models/maintenance_equipment.py +++ b/open_workshop_dokuwiki/models/maintenance_equipment.py @@ -284,6 +284,10 @@ class MaintenanceEquipment(models.Model): # Werte-Dictionary vorbereiten values = self._prepare_template_values(view_type) + # Debug-Logging für partner_ref + if 'partner_ref' in values: + _logger.info(f"partner_ref Wert für {self.name}: '{values['partner_ref']}'") + # Platzhalter ersetzen rendered_content = template_content for key, value in values.items(): @@ -605,7 +609,7 @@ class MaintenanceEquipment(models.Model): # Felder die eine Synchronisation auslösen sync_fields = {'name', 'serial_no', 'ows_area_id', 'category_id', 'status_id', - 'model', 'partner_id', 'location', 'note', 'image_1920', 'tag_ids'} + 'model', 'partner_id', 'partner_ref', 'location', 'note', 'image_1920', 'tag_ids'} # Flag ob Übersichtstabelle aktualisiert werden soll should_update_overview = False @@ -777,6 +781,34 @@ Diese Seite wird automatisch aktualisiert. 'overview_url': '', } + @api.model + def action_clear_template_cache(self): + """ + Leert den Template-Cache und erzwingt ein Neuladen aller Templates aus DokuWiki. + Nützlich nach Template-Änderungen im Wiki. + + Returns: + dict: Notification mit Anzahl geleerte Cache-Einträge + """ + global _template_cache + + count = len(_template_cache) + cache_keys = list(_template_cache.keys()) + _template_cache.clear() + + _logger.info(f"Template-Cache geleert: {count} Einträge ({', '.join(cache_keys)})") + + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _('Template-Cache geleert'), + 'message': _(f'{count} Template(s) aus dem Cache entfernt. Nächster Sync lädt Templates neu.'), + 'type': 'success', + 'sticky': False, + } + } + @api.model def action_reset_wiki_sync_status(self): """ diff --git a/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard.py b/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard.py index 8ca05a0..47b664d 100644 --- a/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard.py +++ b/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard.py @@ -167,3 +167,9 @@ class EquipmentWikiSyncWizard(models.TransientModel): 'target': 'new', 'context': {'show_result': True}, } + + def action_clear_template_cache(self): + """ + Leert den Template-Cache (delegiert an maintenance.equipment). + """ + return self.env['maintenance.equipment'].action_clear_template_cache() diff --git a/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard_views.xml b/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard_views.xml index 9102a0c..43f3c48 100644 --- a/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard_views.xml +++ b/open_workshop_dokuwiki/wizard/equipment_wiki_sync_wizard_views.xml @@ -35,6 +35,12 @@ type="object" class="btn-primary" invisible="context.get('show_result', False)"/> +