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)"/>
+