Skip to content

Comments

[feature]: (#496) Prevent Duplicate service template task from creation#499

Open
Rakeshsingu wants to merge 1 commit intoParaLogicTech:version-15from
Rakeshsingu:prevent_duplicate_task_creation
Open

[feature]: (#496) Prevent Duplicate service template task from creation#499
Rakeshsingu wants to merge 1 commit intoParaLogicTech:version-15from
Rakeshsingu:prevent_duplicate_task_creation

Conversation

@Rakeshsingu
Copy link

Feature: Prevent Duplicate Task Creation for Specific Task Types During Service Template Task Generation

When a Repair Order (Project) has multiple linked Service Templates (e.g. PPF, Tinting),
it's possible for tasks with the same task_type (e.g. "Washing") to appear in multiple templates.

To avoid creating duplicate tasks for such cases, this update introduces:

✅ New Field:

  • prevent_duplicate_task: A checkbox in the Service Template's tasks child table.

💡 Logic:

  • During task creation (create_service_template_tasks):

    1. Collect all task_types where prevent_duplicate_task = 1 from all service templates.
    2. Fetch existing task_types already created for the project.
    3. While iterating tasks:
      • If the task's task_type is in the prevent_duplicate_task list
      • And it already exists in the project (either from the DB or created in this run)
      • ❌ Skip creating that task.
  • Only the first occurrence of such a task type will be created.

  • Ensures clean deduplication across all service templates attached to the same project.

🛠️ Example:

If both "PPF" and "Tinting" templates have a "Washing" task with prevent_duplicate_task = 1,
only the first "Washing" task is created; the duplicate is skipped.


This prevents redundant tasks from being added to the same Repair Order, improving task clarity and reducing confusion for workshop staff.

Closes #496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Repair Order): Option to auto create Washing task without duplicate

1 participant