survey_custom_certificate_t.../docs/TEMPLATE_DELETION_GUIDE.md
2025-11-29 08:46:04 +07:00

5.3 KiB

Template Deletion Guide

Quick Reference: Deleting Custom Certificate Templates

Overview

This guide explains how to delete custom certificate templates from surveys and revert to default template options.

When to Delete a Template

You might want to delete a custom certificate template when:

  • You no longer need custom certificates for a survey
  • You want to switch back to Odoo's default certificate templates
  • You need to start fresh with a new template design
  • The template is outdated or incorrect

How to Delete a Template

Step-by-Step Instructions

  1. Navigate to Survey

    • Go to Surveys app
    • Open the survey with the custom certificate template
  2. Locate Delete Button

    • Scroll to the "Certification" section
    • Find the "Delete Custom Certificate" button
    • The button appears only when:
      • Certification Report Layout = "Custom Template"
      • A custom template is configured
  3. Delete Template

    • Click "Delete Custom Certificate" button
    • Confirm deletion in the dialog box
    • Wait for success notification
  4. Verify Deletion

    • Custom certificate fields are cleared
    • Certification Report Layout is reset
    • You can now select default templates

What Gets Deleted

When you delete a custom certificate template, the following data is removed:

Cleared Fields

  • ✓ Custom certificate template file (DOCX)
  • ✓ Template filename
  • ✓ Placeholder mappings (JSON)
  • ✓ Custom certificate flag
  • ✓ Certification report layout selection

Preserved Data

  • ✓ Survey configuration
  • ✓ Survey questions and answers
  • ✓ Participant responses
  • ✓ Previously generated certificates (as attachments)

Important Notes

Confirmation Required

  • Deletion requires confirmation
  • Action cannot be undone
  • Previously generated certificates remain available

Survey-Specific

  • Deleting a template from one survey doesn't affect other surveys
  • Each survey maintains its own custom template independently

Default Reversion

  • After deletion, certification_report_layout is reset to "no selection"
  • You can then choose from Odoo's default certificate templates
  • Or upload a new custom template

Error Scenarios

No Template to Delete

Error: "No custom certificate template to delete."

Cause: Survey doesn't have a custom certificate configured

Solution: Verify the survey has a custom template before attempting deletion

Button Not Visible

Cause: One of the following conditions:

  • Certification Report Layout is not set to "Custom Template"
  • No custom template is configured (has_custom_certificate = False)

Solution: Check survey configuration and ensure custom template exists

After Deletion

Next Steps

After deleting a custom certificate template, you can:

  1. Use Default Templates

    • Select from Odoo's built-in certificate templates
    • Configure using standard Odoo options
  2. Upload New Template

    • Click "Upload Custom Certificate" button
    • Follow the template configuration wizard
    • Configure new placeholder mappings
  3. Disable Certification

    • Leave certification_report_layout empty
    • Survey will not generate certificates

Technical Details

Database Changes

# Fields set to False after deletion
{
    'custom_cert_template': False,
    'custom_cert_template_filename': False,
    'custom_cert_mappings': False,
    'has_custom_certificate': False,
    'certification_report_layout': False,
}

Logging

Deletion actions are logged with:

  • Survey ID
  • Timestamp
  • Action type (deletion)

Notification

Success notification displays:

  • Title: "Template Deleted"
  • Message: "Custom certificate template has been deleted successfully."
  • Type: Success (green)

Best Practices

Before Deletion

  1. Backup Template: Download the template file if you might need it later
  2. Document Mappings: Note the placeholder mappings for reference
  3. Check Dependencies: Verify no active processes depend on the template
  4. Inform Users: Notify stakeholders about the change

After Deletion

  1. Verify State: Confirm all custom certificate fields are cleared
  2. Test Workflow: Ensure survey still functions correctly
  3. Update Documentation: Update any documentation referencing the custom template
  4. Monitor: Check that certificate generation works with new settings

Troubleshooting

Problem: Delete button not working

Solution:

  1. Check browser console for errors
  2. Verify user has appropriate permissions
  3. Refresh the page and try again
  4. Check Odoo logs for error messages

Problem: Template still appears after deletion

Solution:

  1. Refresh the browser page
  2. Clear browser cache
  3. Check database directly to verify deletion
  4. Contact system administrator

Problem: Cannot select default templates after deletion

Solution:

  1. Verify certification_report_layout field is cleared
  2. Check if default templates are available in your Odoo installation
  3. Restart Odoo server if necessary

Support

For additional help:

  • Check Odoo logs: /var/log/odoo/odoo.log
  • Review module documentation
  • Contact system administrator
  • Refer to Odoo Survey documentation