Repository navigation
[Main] - Slice 641538: [Expense Agent][VENDOR] Travel Request Approvals - #14389
v-rohangarg20 wants to merge 6 commits into
Conversation
|
The page is declared as PageType = Document but is named "Travel Request Card". Document pages should use the document name rather than a Card-page suffix so the name matches the page-type convention. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7 |
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesAdds travel request approval routing by approval limit, alternate approver coverage, owner recall, and renewed approval. It also exposes routing fields and actions through the API and records approval history. Normal submission escalates to an approver with enough authority before assigning alternate coverage. However, delegation of an older, unrouted request can bypass approval limits. The release tests also disagree about whether release is allowed with the agent enabled. Problem-solution fitFit: Partial The change implements a coherent travel approval workflow. Approval authority must also be enforced for previously released requests, and the release test must match the submission contract. SuggestionsS1 (🔴 High): Validate primary approval authority before alternate approval S2 (🟠 Moderate): Remove the approval API name collisions S3 (🟠 Moderate): Keep the release test consistent with submission Risk assessment and necessityRisk: Approval routing controls financial authority. An unrouted request can become Approved and create traveler expense reports through an alternate without a primary approver who can authorize its amount. The BaseApp Necessity: Without this change, travel requests lack automatic limit escalation, alternate coverage routing, and an owner recall action, so these operations need manual coordination. The scope fits an approval feature, but the approval-limit bypass must be fixed before merge.
|
aa7d39a to
5da1efb
Compare
S1- Approval Limit won't be check for Alternate Approver. Keep similar changes as Expense Report. |
|
This API page uses ODataKeyFields = SystemId but links the travel-request detail and traveler parts through the business field "Spend Request No." = field("No."). Use a Guid child foreign key related to the parent SystemId and link both API parts with Field(SystemId), so navigation and deep-insert references use the API's stable identity. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7 |
5da1efb to
c3ad4e9
Compare
|
The parent API is keyed by SystemId, but the travelRequestDetails and travelers API parts link through the parent No. field. Link these child relationships through a Guid foreign key and Field(SystemId) so navigation and deep-insert references use the same stable API identity. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7 |
Good Sense Reviewer - Round 2Recommendation: Request ChangesWhat this PR doesAdds travel request approval routing, approval-limit escalation, alternate coverage, recall, renewed approval and activity history. The API naming collision and inconsistent release test are corrected. Normal submission selects a primary with enough authority before assigning an alternate. However, Problem-solution fitFit: Partial The feature implements a coherent approval workflow. The alternate's own limit may be skipped, but an unrouted request must first have a primary who can authorize its amount. Status of previous suggestions
S1 (🔴 High): Validate primary approval authority before alternate approval Normal Expense Report submission establishes a sufficient primary before assigning alternate coverage. The travel fallback does not, and the alternate-limit test uses an unlimited primary rather than the failing legacy scenario. New observations (commits since round 1)None - S1 remains the existing blocker. Risk assessment and necessityRisk: The remaining path can authorize an over-limit request and create traveler expense reports without a primary who can approve its amount. Release and reopen publisher timing is correct. Tests cover normal escalation and alternate approval, but not delegation of an unrouted request with an under-limit primary. Runtime tests were not executed for this review. Necessity: Travel requests need configured approval routing, alternate coverage, recall and history. The feature scope is appropriate, but financial authority must also hold for existing released requests.
|
S1 - When an Alternate Approver is assigned, the system does not validate the approval limits of either the Primary Approver or the Alternate Approver. We need to maintain the same approval limit validation logic as in the Expense Report process. |
Good Sense Reviewer - ReplyS1 - Hold. Expense Report skips the alternate's own limit, but
|
Good Sense Reviewer - Round 4Recommendation: Request ChangesWhat this PR doesAdds travel-approval routing, alternate coverage, recall, renewed approval, API actions, and history. This round only moves the approval test codeunit to 148369 and extends its app range; it changes no production approval behavior. The earlier authority-routing, API naming, and release-contract fixes remain present. The requester/traveler ownership mismatch and legacy pending-list issue are unchanged. Problem-solution fitFit: Partial The mechanical test-ID update is scoped correctly, but it does not resolve the remaining ownership blocker or legacy-list inconsistency. Status of previous suggestions
S4 (🔴 High): Keep approval ownership aligned with API navigation S5 (🟠 Moderate): Align legacy pending lists with approval-limit routing New observations (commits since round 3)None. Risk assessment and necessityRisk: The changed test ID is inside the updated test-app range. Production routing still disagrees with requester-scoped navigation when requester and traveler differ. Legacy over-limit requests need another routing operation before their effective approver can discover them. No new issue is attributable to this round. Necessity: The feature removes manual coordination for approval escalation, coverage, recall, and renewed approval. The test-ID correction is useful, but a consistent ownership contract remains necessary before merge.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Use codeunit 148371 and extend the test app ID range to include it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| TravelRequestCard: TestPage "Travel Request Card"; | ||
| begin | ||
| // [SCENARIO] Releasing a rejected travel request from the card starts a new approval without the decision and comment of the previous one. | ||
| // [SCENARIO] Releasing a rejected travel request from the card, with the agent disabled, approves it without the decision and comment of the previous approval. |
There was a problem hiding this comment.
SpendRequestTest mixes direct TravelRequestApproval logic tests with TestPage-driven tests. Split the page/UI tests into a separate test codeunit so failures identify whether the business logic or page layer is under test.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
| // [THEN] The travel request is approved automatically, and the rejection details and the submitter comment are cleared. | ||
| SpendRequest.Get(SpendRequest."No."); | ||
| SpendRequest.TestField(Status, SpendRequest.Status::Released); | ||
| SpendRequest.TestField(Status, SpendRequest.Status::Approved); |
There was a problem hiding this comment.
ReleaseActionRespectsAgentSetupAndStatus contains three separate WHEN blocks for three independent enabled-state cases. Split the open/disabled, released, and agent-enabled cases into focused tests so each test has one action and one claim.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
| Editable = false; | ||
| } | ||
| field(assignedApproverExpenseUserNo; Rec."Approver Expense User No.") | ||
| { |
There was a problem hiding this comment.
This change adds fields to the existing beta API page, mutating the shape of an already published API contract. Preserve the existing page object and publish the expanded shape through a separate API page/version so clients of the current contract continue to receive the original fields and behavior.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
…res/Slice-641538-Travel-Request-Approvals
|
|
||
| SpendRequest.SetRange("Document Type", SpendRequest."Document Type"::"Travel Request"); | ||
| SpendRequest.SetRange(Status, SpendRequest.Status::Released); | ||
| SpendRequest.SetRange("Approver Expense User No.", Rec."No."); |
There was a problem hiding this comment.
The approval-rights validation checks only Approver Expense User No., which contains the alternate approver while a request is delegated. This allows the retained primary approver to be disabled; when coverage ends, RevertEndedCoverage then refuses to restore that primary approver and leaves the request assigned to expired coverage. Also block removal of approval rights when the user is referenced by Primary Approver No., or atomically reroute those pending requests.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
| SpendRequest.SetRange("Approver Expense User No.", Rec."No."); | ||
| SpendRequest.SetLoadFields("No."); | ||
| if SpendRequest.FindFirst() then | ||
| Error(CannotRemovePendingTravelApproverErr, Rec."No.", SpendRequest."No."); |
There was a problem hiding this comment.
Disabling approval rights is blocked with a plain Error that names the pending travel request and tells the user to complete or reassign it. Attach an ErrorInfo navigation action to the related travel request (or an equivalent reassignment surface) so the known corrective path is available from the error.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
|
|
||
| AlternateApproverExpenseUserNo := ExpenseReportApprovalMgmt.GetActiveAlternateApproverNo(GetPrimaryApproverNo(SpendRequest), WorkDate()); | ||
| if AlternateApproverExpenseUserNo = '' then | ||
| Error(NoActiveAlternateApproverForDateErr, GetPrimaryApproverNo(SpendRequest), WorkDate()); |
There was a problem hiding this comment.
When no active alternate approver exists for the selected approver and date, the plain Error gives the user no navigation or recommended action even though the required correction is to configure or select alternate-approver coverage. Raise an ErrorInfo with a suitable setup navigation action.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
| end; | ||
|
|
||
| [Test] | ||
| procedure ApproverFilterFollowsRoutedApprover() |
There was a problem hiding this comment.
ApproverFilterFollowsRoutedApprover contains two separate WHEN actions that apply different approver filters and assert different outcomes. Split it into focused tests so each test has one action under test.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v10.0.7
Good Sense Reviewer - Round 5Recommendation: Request ChangesWhat this PR doesAdds travel request approval routing, approval-limit escalation, alternate coverage, recall, renewed approval, API actions, and activity history. The changes since round 4 only move the approval test codeunit to 148371 and extend the test-app range to 148379; they change no approval logic. The primary-authority routing, API naming, and release-contract fixes remain present. Rejection reopens the request while retaining rejection details and clearing routing; recall and renewed approval have focused state-transition tests. The requester/traveler ownership mismatch and legacy pending-list issue remain. Problem-solution fitFit: Partial The approval feature is coherent, and the test-ID correction is scoped correctly. The remaining ownership mismatch still blocks normal submission and recall when a request is created for another traveler. Status of previous suggestions
S4 (🔴 High): Keep approval ownership aligned with API navigation S5 (🟠 Moderate): Align legacy pending lists with approval-limit routing New observations (commits since round 4)None - the new changes only adjust the test object ID and manifest range. The ID is unique in the inspected application sources and within the declared range. Risk assessment and necessityRisk: The new test-ID changes are low risk. The full feature still blocks creator-scoped submission and recall when requester and traveler differ, and legacy over-limit requests can be absent from their effective approver's pending list. Approval also creates traveler expense reports, so transaction and lifecycle consistency matter. The release and reopen publishers run after status persistence; tests cover rejection ordering, rollback, recall, renewed approval, and replacement reports after canceled posted history. Tests and builds were not run during this read-only review. Necessity: The feature removes manual coordination for travel approval escalation, alternate coverage, recall, and history. Without it, agent-managed travel requests lack this complete approval workflow. The test-ID correction is useful, but consistent ownership remains necessary before merge.
|
Summary
Introduces Travel Request Approvals functionality for Expense Agent Vendor.
Changes
Adds support for Travel Request Approvals in Expense Agent Vendor.
Implements the approval workflow for travel requests.
Enables vendors to manage travel request approvals.
Work Items
AB#641538