[WI-000983][Bonus Request Update][WI-000984][Auto-Recurring Bonus Update][WI-000985][ Row-Level Approval Gates & Workflow Rules]#6205
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the Bonus Request feature from a single-employee document into a consolidated multi-employee request using a child table, updates bulk creation to generate one document, aligns workflow/notifications, and adds a migration patch plus updated print formats for per-employee output.
Changes:
- Converts Bonus Request to use
items(child table) +requested_by+total_bonus_amount, and adds a newBonus Request ItemsDocType. - Reworks bulk creation to call a new server API that creates one consolidated Bonus Request with multiple child rows.
- Updates workflow, assignment-rule templates, print formats, and adds a patch to migrate existing data.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| one_fm/patches/v15_0/migrate_bonus_request_to_grid.py | Migrates legacy single-employee Bonus Requests into child rows and sets new parent fields. |
| one_fm/patches.txt | Registers the migration patch for execution. |
| one_fm/one_fm/print_format/bonus_request_form/bonus_request_form.json | Updates print format to iterate over doc.items and render one page per employee. |
| one_fm/one_fm/print_format/bonus_acknowledgment_letter/bonus_acknowledgment_letter.json | Updates acknowledgment letter to iterate over child rows with page breaks. |
| one_fm/one_fm/doctype/bonus_request/bonus_request.py | Implements requested-by defaults, stricter effective-month validation, totals calc, and consolidated creation API. |
| one_fm/one_fm/doctype/bonus_request/bonus_request.json | Updates parent DocType schema to remove old fields and add child table + totals/requester fields. |
| one_fm/one_fm/doctype/bonus_request/bonus_request.js | Adds requested-by autofill and recalculates total from child rows. |
| one_fm/one_fm/doctype/bonus_request/bonus_request_list.js | Updates bulk dialog UI and switches primary action to consolidated creation API. |
| one_fm/one_fm/doctype/bonus_request_items/bonus_request_items.py | Adds the new child table controller (type stubs). |
| one_fm/one_fm/doctype/bonus_request_items/bonus_request_items.json | Defines child table fields (employee details, justification/description, bonus amount). |
| one_fm/one_fm/doctype/bonus_request_items/init.py | Initializes the new child DocType module. |
| one_fm/custom/workflow/bonus_request.json | Removes “Pending General Manager” workflow state/transitions and simplifies approval flow. |
| one_fm/custom/assignment_rule/bonus_request_hr_manager.json | Updates assignment email template variables for consolidated model. |
| one_fm/custom/assignment_rule/bonus_request_finance_manager.json | Updates assignment email template variables for consolidated model. |
| one_fm/custom/assignment_rule/bonus_request_payroll_operator.json | Updates assignment email template variables for consolidated model. |
| one_fm/custom/assignment_rule/bonus_request_general_manager.json | Disables the GM assignment rule to reflect workflow removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NoBoneZ
approved these changes
Jun 9, 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.
Is this a Feature, Chore or Bug?
Clearly and concisely describe the feature, chore or bug.
Refactored the Bonus Request DocType from a one-employee-per-document model to a multi-employee grid table model. A single Bonus Request now supports adding single or multiple employees via a child table (
Bonus Request Items), with per-employee justification and bonus amounts. The bulk modal now creates a single consolidated document instead of individual records. The "Pending General Manager" workflow step has been removed, and the effective month validation now blocks the current month in addition to past months.Analysis and design (optional)
User Story: As a Requester, I want to add employees into a grid table within a single document so that I can process single or bulk team requests efficiently without creating individual separate records.
Key design decisions:
requested_byis a Link to Employee, auto-set from the current session user on document creation.total_bonus_amountis a read-only Currency field that auto-calculates as the sum of all child rowbonus_amountvalues.justificationSelect dropdown per child row (8 options + "Other" which triggers a mandatorydescriptionfield).{% for item in doc.items %}with CSS page breaks.Solution description
Parent DocType (
Bonus Request)employee,employee_name,employee_id,designation,department,bonus_amount,increased_productivity,improved_work_processes,significant_effort,star_performer,others,justification, and related layout breaks.requested_by(Link → Employee, read_only),requested_by_name(Data, fetch_from),items(Table → Bonus Request Items, reqd),total_bonus_amount(Currency, read_only).Child Table DocType (
Bonus Request Items) — NEWbonus_request_items.json,bonus_request_items.py,__init__.py.employee,employee_name,designation,department,operations_site,project,justification(Select with 8 options),description(conditional on "Other"),bonus_amount,approve,reject.Python Controller (
bonus_request.py)before_insert(): Auto-setsrequested_byfrom current user's Employee record and defaultseffective_year.validate_self_request(): Iteratesself.items— throws if any row contains the current user's employee.validate_effective_month(): Now blocks current month AND past months (stricter than before).calculate_total_bonus_amount(): Sumsbonus_amountacross all child rows.create_consolidated_bonus_request(): Creates a single Bonus Request with all employees as child rows.create_bulk_bonus_requests()and_create_bulk_bonus_requests_bg().Client Script (
bonus_request.js)setup(): Auto-fetchesrequested_byfor new documents.total_bonus_amountonbonus_amountchange, row add, and row remove.toggle_justification()function and "Print Bonus Request Form" button.List View Script (
bonus_request_list.js)justificationSelect dropdown.descriptionfield (visible/mandatory when justification == "Other").create_consolidated_bonus_requestand navigates to the new document.Workflow (
bonus_request.json)Pending HR Manager → Approve → Pending Finance Manager(no condition).Assignment Rules
bonus_request_general_manager.json: Disabled (disabled: 1).{{employee}}→{{requested_by_name}},{{bonus_amount}}→{{total_bonus_amount}}).Print Formats
doc.items, generates separate page per employee with page breaks.Data Migration Patch (
migrate_bonus_request_to_grid.py)others→ "Other",star_performer→ "Special Recognition", others → "Excellent Performance").requested_byfrom document owner, calculatestotal_bonus_amount.patches.txtunder[post_model_sync].Is there a business logic within a doctype?
Yes
No
Self-request prevention: Users cannot include themselves in a bonus request.
Effective month must be strictly in the future (current month blocked).
Total bonus amount auto-calculated from child table rows.
Justification "Other" requires mandatory description.
Output screenshots (optional)
N/A — to be verified after deployment.
Areas affected and ensured
Is there any existing behavior change of other features due to this code change?
Yes.
Did you test with the following dataset?
Was child table created?
N/A — no attachment fields in child table.
Did you delete custom field?
Is patch required?
Patch:
one_fm.patches.v15_0.migrate_bonus_request_to_grid[post_model_sync]section ofpatches.txt.bench migrate.Which browser(s) did you use for testing?
Screen.Recording.2026-06-09.at.12.52.23.AM.mov
Screen.Recording.2026-06-09.at.1.58.17.AM.mov
Screen.Recording.2026-06-09.at.2.08.55.AM.mov