fix: ticket template fields in ticket Edit#6185
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Helpdesk ticket edit flow so the frontend loads ticket field definitions from the “Default” ticket template and the backend returns the full HD Ticket document (including custom fields), enabling broader field rendering and validation during ticket edits.
Changes:
- Frontend: Ticket edit form now loads fields from the “Default” template and maps ticket document values into the form model.
- Frontend: Required-field validation expanded beyond priority/process to all required template fields plus subject/description.
- Backend:
get_ticket_detailsnow returnsHD Ticketas a fullas_dict()payload instead of a limited subset.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue | Loads Default template fields, maps values from full ticket doc, and validates required fields before update. |
| one_fm/overrides/hd_ticket.py | Returns the full HD Ticket document from get_ticket_details. |
| one_fm/after_migrate/execute.py | Removes deployment steps for TicketCustomer/TicketNew from the ticket views deployment helper. |
Comments suppressed due to low confidence (1)
one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue:195
fetchTicketDetails()callssetupCustomizations()even when no template fields were loaded (e.g., template fetch fails), andoldFieldsis only initialized when the template returns fields. In that failure path, fallback fields are injected later inonMounted(), but customizations/filters won’t be set up for those injected fields (andoldFieldsremains[]), which can break field behavior.
const templateRes = await call("helpdesk.helpdesk.doctype.hd_ticket_template.api.get_one", {
name: "Default",
});
if (templateRes && templateRes.fields && templateRes.fields.length) {
templateData.value.fields = templateRes.fields;
oldFields = JSON.parse(JSON.stringify(templateRes.fields));
}
for (const field of templateData.value.fields) {
const key = field.fieldname;
// Try to get custom field value from ticket document
const customKey = key.startsWith("custom_") ? key : `custom_${key}`;
const value = (data?.[customKey] ?? data?.[key] ?? "");
templateFields[key] = value;
}
setupCustomizations(templateData, {
doc: templateFields,
call,
router,
$dialog,
applyFilters,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NoBoneZ
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the ticket editing workflow to improve field handling and validation for the ticket edit form. The main changes focus on always loading field templates from the default template, simplifying field filtering, and ensuring all required fields are validated before submission. Additionally, the backend now returns the full ticket document, allowing access to all custom fields.
Frontend improvements to ticket editing:
TicketEdit.vue) now always loads field definitions from the "Default" template, ensuring consistency and availability of all custom fields. Fallback fields are only injected if the template fails to provide fields. [1] [2]Backend improvements:
get_ticket_detailsmethod now returns the entire ticket document (including all custom fields), rather than a limited set of fields, enabling the frontend to access all necessary data for rendering and editing.Code cleanup:
TicketCustomer.vueandTicketNew.vuehas been removed from the deployment script, possibly because these files are no longer needed or are handled elsewhere.