survey_custom_certificate_t.../views/survey_survey_views.xml
2025-11-29 08:46:04 +07:00

55 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Extend survey.survey form view to add custom certificate functionality -->
<record id="survey_survey_form_view_inherit_custom_cert" model="ir.ui.view">
<field name="name">survey.survey.form.inherit.custom.cert</field>
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_survey_view_form"/>
<field name="arch" type="xml">
<!-- Add custom certificate option to certification_report_layout selection -->
<xpath expr="//field[@name='certification_report_layout']" position="after">
<!-- Button to open custom certificate wizard -->
<button name="action_open_custom_certificate_wizard"
string="Upload Custom Certificate"
type="object"
icon="fa-upload"
class="btn-link pt-0"
invisible="certification_report_layout != 'custom'"
help="Upload and configure a custom DOCX certificate template"/>
<!-- Preview button for configured custom templates -->
<button name="action_survey_preview_certification_template"
string="Preview Custom Certificate"
type="object"
icon="fa-external-link"
target="_blank"
class="btn-link pt-0"
invisible="certification_report_layout != 'custom' or not has_custom_certificate"
help="Preview the configured custom certificate template"/>
<!-- Delete button for custom templates -->
<button name="action_delete_custom_certificate"
string="Delete Custom Certificate"
type="object"
icon="fa-trash"
class="btn-link pt-0"
invisible="certification_report_layout != 'custom' or not has_custom_certificate"
confirm="Are you sure you want to delete this custom certificate template? This action cannot be undone."
help="Delete the custom certificate template and revert to default options"/>
<!-- Status indicator for custom certificate configuration -->
<div invisible="certification_report_layout != 'custom'" class="text-muted small">
<span invisible="has_custom_certificate">
<i class="fa fa-info-circle"/> No custom template uploaded yet. Click "Upload Custom Certificate" to configure.
</span>
<span invisible="not has_custom_certificate">
<i class="fa fa-check-circle text-success"/> Custom template configured
</span>
</div>
</xpath>
</field>
</record>
</odoo>