Skip to content

Add bulk timeslot assignment wizard for PTI managers#6

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-bulk-timeslot-add-form
Draft

Add bulk timeslot assignment wizard for PTI managers#6
Copilot wants to merge 2 commits intomainfrom
copilot/create-bulk-timeslot-add-form

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

Managers need a way to assign all time slots to multiple teachers at once rather than one-by-one. This adds a wizard dialog accessible under PTI > Configuration > Bulk Add Time Slots.

Changes

  • wizard/bulk_timeslot_wizard.pypti.bulk.timeslot.wizard TransientModel:

    • teacher_ids (Many2many res.partner) — teacher selection
    • time_slot_ids (Many2many pti.cycle.time.slot) — all slots pre-selected by default via search([])
    • action_add_timeslots() — fetches all existing combinations in one query, batch-creates only missing records, returns a display_notification toast with count then closes the dialog
  • views/bulk_timeslot_wizard_views.xml — dialog form with many2many_tags teacher picker, editable slot list, and Add/Cancel footer buttons; target="new" window action

  • security/ir.model.access.csv — PTI Manager full CRUD on wizard model

  • views/menu.xml — "Bulk Add Time Slots" menu item under Configuration (Manager only, sequence 30)

Logic: skip existing, batch-create missing

existing = PartnerTimeSlot.search([
    ('partner_id', 'in', teacher_ids),
    ('time_slot_id', 'in', slot_ids),
])
existing_pairs = {(rec.partner_id.id, rec.time_slot_id.id) for rec in existing}

to_create = [
    {'partner_id': t, 'time_slot_id': s, 'status': 'available'}
    for t in teacher_ids
    for s in slot_ids
    if (t, s) not in existing_pairs
]
if to_create:
    PartnerTimeSlot.create(to_create)

Single lookup query + single batch insert regardless of how many teachers/slots are selected.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create a bulk timeslot add form</issue_title>
<issue_description>
I want to create timeslots for all teachers in just a few steps. The form should

Allow me to select all the teachers I want. At this point just show the employee selection form
Select the timeslots from a list on the form we want to add to these teachers. All should be selected by default.
The action should not modify any existing timeslots - just add the missing ones.
Report its success or failure in a toast message</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Add bulk timeslot add form for teachers Add bulk timeslot assignment wizard for PTI managers Mar 26, 2026
Copilot AI requested a review from agrogers March 26, 2026 15:58
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.

Create a bulk timeslot add form

2 participants