Skip to content

[pull] develop from frappe:develop#394

Merged
pull[bot] merged 11 commits into
thispl:developfrom
frappe:develop
Jul 15, 2026
Merged

[pull] develop from frappe:develop#394
pull[bot] merged 11 commits into
thispl:developfrom
frappe:develop

Conversation

@pull

@pull pull Bot commented Jul 15, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

iamkhanraheel and others added 11 commits July 4, 2026 05:40
…a Roster API

Two root causes found and fixed:

1. **on_cancel does not update status field**: When a Shift Assignment is
   cancelled, docstatus changes to 2 (framework-level), but the status
   field incorrectly remains 'Active'. This causes the cancelled record
   to match the adjacency filters in insert_shift(), which filter by
   status='Active'.

   Fix: Set status to 'Inactive' in on_cancel via db_set. 'Inactive' is
   an existing recognized status value in this doctype (used at line 99).

2. **insert_shift() lacks docstatus filter**: The adjacency detection at
   line 224 uses frappe.db.exists() without filtering out cancelled
   records (docstatus=2). Even with Fix 1, this is needed as
   defense-in-depth since frappe.db.exists() does not implicitly filter
   by docstatus.

   Fix: Add 'docstatus': ['!=', 2] to the filters dict.

**Impact**: insert_shift() is @frappe.whitelist() decorated and called
directly by ShiftAssignmentDialog.vue in the Roster view. When a user
cancels a shift and creates a new one for an adjacent date range:
- The cancelled record's end_date is silently mutated via db.set_value
- No new assignment is created (the else branch is never reached)
- The frontend shows 'Shift Assignment created successfully!' toast

**Reproduction**: Create a shift (Jul 1-10), submit, cancel. Call
insert_shift for Jul 11-20. Before fix: cancelled record's end_date
changes from Jul 10 to Jul 20, zero new records created. After fix:
cancelled record untouched, new submitted assignment created correctly.

Includes regression test in test_roster.py.
- Resolves MariaDB 12.3 reserved word issue (to_date/from_date) by leveraging Frappe Query Builder for automatic identifier quoting.
- Replaces raw frappe.db.sql calls with frappe.qb in:
  - utils.py (get_leave_period)
  - leave_allocation.py (validate_allocation_overlap)
  - leave_application.py (get_leave_entries)
  - leave_ledger_entry.py (validate_leave_allocation_against_leave_application)
- Adds backticks to the remaining raw SQL snippet (get_doc_condition) and complex NOT EXISTS subquery (expire_allocation) where query builder translation is not feasible/clean.
…quoting

fix(mariadb): quote from_date and to_date to resolve reserved word errors
…ication-config-fetch-when-relay-is-not-configured

fix(pwa): skip push notification config fetch without relay
…ment-blocks-creation

fix: cancelled Shift Assignments silently block new shift creation via Roster API
…ave_allocation

fix(leave_policy_assignment): half-yearly earned leave schedule for joining date based assignments
@pull pull Bot locked and limited conversation to collaborators Jul 15, 2026
@pull pull Bot added the ⤵️ pull label Jul 15, 2026
@pull
pull Bot merged commit 0dd3938 into thispl:develop Jul 15, 2026
12 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants