[pull] develop from frappe:develop#394
Merged
Merged
Conversation
…le for joining date based assignment
…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
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 : )