Repository navigation
[Main] - Bug 640772: Expense Agent: If the accountant wants to change some simple things like dimensions or accounts to post to, the entire approval flow has to be redone - #14128
v-rohangarg20 wants to merge 6 commits into
Conversation
|
FieldsCannotBeChangedWhenExpenseReportIsReleased contains three independent WHEN actions and assertions in one test. Split the field-change checks into focused tests so a failure identifies the specific behavior that broke. 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 |
0a25cf6 to
2733a00
Compare
d864f70 to
b19e174
Compare
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change allows accounting corrections on submitted and approved expense reports without repeating approval. It adds change history, exposes that history on pages and APIs, and transfers it to the posted report. Removing the Open-status checks addresses most of the reported workflow, and the new tests cover tracking, history lifecycle, and posting checks. However, the new codeunit conflicts with an existing country-app object, VAT corrections can leave posting inconsistent with the saved line, and posting can reject corrected reports using stale rule violations. Problem-solution fitFit: Partial Most requested accounting fields become editable and audited without changing report status. Payment Method Code remains locked and unaudited, and the newly enabled VAT correction paths need additional safeguards. SuggestionsS1 (🔴 High): Choose a codeunit ID unused by country apps S2 (🔴 High): VAT liability corrections leave specification posting unchanged S3 (🟠 Moderate): Payment method corrections still require report reopening S4 (🟠 Moderate): Posting checks stale violations instead of current rules Risk assessment and necessityRisk: This changes approved financial data and the posting checks that protect it. The Austrian default build retains codeunit 6914, conflicting with the new change-log codeunit. VAT-specification posting can ignore a corrected VAT Liable flag; the same newly enabled validation path also commits a line and its history before vendor selection succeeds, so a failed correction can leave approved data changed. The new history lifecycle follows the existing activity-log pattern, and no new BaseApp event dependency was found. This was a pinned-source review; no build or BC tests were run. Necessity: Routine accounting corrections should not require reopening reports and repeating approval. Without this change, that remains the workaround; allowing these edits and keeping durable history is justified, but financial consistency and country-app compatibility must be preserved.
|
b19e174 to
300d5ca
Compare
300d5ca to
8c54124
Compare
“S1 – Fixed” S2 – Known limitation: VAT Liable S3 – By Design: Payment Method Code Payment Method Code is intentionally excluded from change tracking and post-submission corrections because it is subject to reimbursement-type validation rules. These rules must remain enforced to prevent changes that could violate existing business logic. S4 – By design, with a known limitation: Rule validation |
61abd59 to
d013357
Compare
Good Sense Reviewer - Round 2Recommendation: Request ChangesWhat this PR doesThis change allows accounting corrections on submitted and approved expense reports without repeating approval. It records field changes, exposes history on pages and APIs, and transfers that history to the posted report. The follow-up renumbers the change-log codeunit, but the replacement ID also conflicts with a dependent country app. The VAT-specification inconsistency remains, and the newly enabled VAT correction path can commit approved data before validation succeeds. Most requested corrections are supported, but payment-method corrections remain excluded. Status of previous suggestions
S1 (🔴 High): Choose a codeunit ID unused by country apps S2 (🔴 High): VAT liability corrections leave specification posting unchanged S4 (🟠 Moderate): Posting checks stale violations instead of current rules S3 (🟠 Moderate): Payment method corrections still require report reopening New observations (commits since round 1)S5 (🔴 High): Failed VAT corrections still change approved reports Risk assessment and necessityRisk: This changes approved financial data and posting safeguards. Codeunit 6915 conflicts with the Australian dependent app; VAT posting can ignore the corrected flag, and failed vendor selection can leave a correction committed before amount recalculation. History reassignment and deletion follow the existing activity-log pattern, and no new BaseApp publisher dependency was found. The tests cover history and posting guards but do not establish correctness for these VAT paths. This was a pinned-source review; no build, compilation, or BC tests were run. Necessity: Routine accounting corrections should not require reopening reports and repeating approval. Without this change, that remains the workaround. Allowing these corrections with durable history is justified, but deployment compatibility and financial consistency must be preserved.
|
|
d013357 to
550a1f5
Compare
…tory Accountants can change dimensions and accounting fields (accounts, billing, purchase invoice, merchant, project, and VAT) on submitted expense reports without reopening them. Each change is logged with the old value, the new value, and the user who made it. - Add the Exp. Report Change Log Entry table, Change History page, and Change History actions on the expense report, manager, posted report, and line subforms. - Move change history to the posted expense report on posting and delete it with the report or line. - Re-check mandatory accounting fields and rule violations on posting. - Expose change history through the expense report and posted expense report APIs. - Classify the new table for privacy and add permissions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
550a1f5 to
e41d051
Compare
…tory Accountants can change dimensions and accounting fields (accounts, billing, purchase invoice, merchant, project, and VAT) on submitted expense reports without reopening them. Each change is logged with the old value, the new value, and the user who made it. - Add the Exp. Report Change Log Entry table, Change History page, and Change History actions on the expense report, manager, posted report, and line subforms. - Move change history to the posted expense report on posting and delete it with the report or line. - Re-check mandatory accounting fields and rule violations on posting. - Expose change history through the expense report and posted expense report APIs. - Classify the new table for privacy and add permissions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e41d051 to
bbcfb64
Compare
Good Sense Reviewer - Round 3Recommendation: Request ChangesWhat this PR doesAllows most accounting corrections without repeating expense-report approval and adds durable field history, page/API access, and posting checks. The rewritten change moves the manager to codeunit 6916, but that ID still conflicts with a dependent country app. VAT specifications can ignore a corrected liability flag, and failed vendor selection can leave the correction committed. The other previously disputed gaps remain, and account corrections can overwrite approved descriptions without history. Problem-solution fitFit: Partial Most accounting corrections retain approval and gain history, but valid payment-method corrections remain excluded and approved VAT corrections remain unsafe. Status of previous suggestions
S1 (🔴 High): Choose a codeunit ID unused by country apps S2 (🔴 High): VAT liability corrections leave specification posting unchanged S5 (🔴 High): Failed VAT corrections still change approved reports S4 (🟠 Moderate): Posting checks stale violations instead of current rules S3 (🟠 Moderate): Payment method corrections still require report reopening New observations (commits since round 2)S6 (🟠 Moderate): Preserve approved descriptions during account corrections Risk assessment and necessityRisk: Codeunit 6916 remains declared in the Canadian dependency in Default builds; pending obsoletion does not remove it. The two VAT paths can produce wrong posting or persist a failed correction. Tests cover history and posting guards but bypass those validation paths. No new BaseApp publisher dependency or production signature change is introduced. Necessity: Routine corrections should not require another approval. Keeping approval and history is justified, but known limitations do not make incorrect VAT posting or committed failed corrections safe.
|
…ry apps (microsoft#14405) ## What & why Renumbers three Expense Agent codeunits whose IDs collide with the deprecated `Expense Agent (<country>)` apps, and documents the reserved IDs in the Expense Agent README. | Codeunit | Old | New | Collides with deprecated app | |---|---|---|---| | Expense Agent Quota Impl. | 6913 | 6923 | Expense Agent (Preview) (US), `fa126935-93d3-4e4e-a006-4f7406625d2e` | | Travel Req. Linked Reports | 6914 | 6924 | Expense Agent (Preview) (AT), `c60a4c19-38b7-4d2b-96bb-edfcea98cf1f` | | No Receipt Declaration Mgt. | 6915 | 6925 | Expense Agent (Preview) (AU), `646b8424-68af-4eb3-b325-97f695cdb19f` | Each deprecated country app in `src/Apps/<country>/ExpenseAgent_<country>` declares one codeunit in the Expense Agent ID range (6913-6921, 6977). Those apps are no longer built, so the compiler cannot detect a clash, but they are still installed on many tenants. Reusing their IDs makes installs, upgrades and app hotfixes fail with: ``` The application object of type 'CodeUnit' with the ID '6913' is defined in multiple apps. The apps are: Expense Agent (Preview) by Microsoft 29.0.54011.58216; Expense Agent (Preview) (US) by Microsoft 29.0.54011.54125. ``` This is happening in production now: the 29.0/29.1 Expense Agent app hotfix fails for ~8,000 US environments (8,042 of 8,048 from 29.0.54011.57244 to 29.0.54011.58216). The ManagementService removal of legacy country apps (Bug 658936) only runs on full upgrades, not app hotfixes. The README note lists the reserved codeunit IDs for reviewers and coding agents. Excluding them from `idRanges` is not possible: the range applies to all object types and 30 existing tables, pages and enums use these IDs (AL0297). Backports: - releases/29.0: microsoft#14406 (6913) - releases/29.1: microsoft#14407 (6913, 6914) - releases/29.x: microsoft#14408 (6913, 6914) ## Linked work Fixes [AB#660284](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/660284), [AB#660285](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/660285), [AB#660279](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/660279) Related [AB#660280](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/660280) ## How I validated this - [x] I read the full diff and it contains only changes I intended. - [x] I built the affected app(s) locally with no new analyzer warnings. - [x] I ran the change in Business Central and confirmed it behaves as expected. - [x] I added or updated tests for the new behavior, or explained below why none are needed. **What I tested and the outcome** - Compiled the Expense Agent app and the Expense Agent test app on this branch against local W1 symbols: no errors. - Pre-checks on main, 29.x, 29.1 and 29.0: 6923-6925 are unused (app, demo data, test); no numeric references to 6913-6915 (`Codeunit::<id>`, `Codeunit.Run(<id>)`, `Object ID to Run`). All three codeunits are `Access = Internal` and referenced by name only, so no other code changes and no upgrade code are needed. - Local repro on a W1 server (main): with Expense Agent declaring 6913-6915, `Install-NAVApp` of the legacy US, AT and AU apps fails with the duplicate-object error above. After force-upgrading to an Expense Agent build with the three codeunits renumbered, all three legacy apps install side by side with Expense Agent. - Independent scan of all 20 legacy apps (agent + demo data) against the W1 Expense Agent apps on 29.0, 29.1, 29.x and main: these three are the only collisions (by type+ID and type+name). - No new tests: an object ID change does not change behavior, and existing tests reference the codeunits by name. ## Risk & compatibility Low. Codeunits have no data; the upgrade moves them to the new IDs within the same app. Telemetry or queries filtering on these object IDs need updating. Open PRs microsoft#13244, microsoft#13875 (codeunit 6914) and microsoft#14128, microsoft#14190 (codeunit 6915) also use reserved IDs and need new IDs before merge. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfee079b-1385-4f90-ad44-940fefe25116
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Good Sense Reviewer - Round 4Recommendation: Request ChangesWhat this PR doesAllows accounting corrections after submission without repeating approval, records field history, and transfers that history to the posted report. The update resolves a test-codeunit overlap by using ID 148370 and extending the test manifest range. The change-log manager and expense-line production code are unchanged from the previous round. The country-app codeunit collision and both VAT blockers therefore remain; unrelated changes merged from the base branch are not new findings. Problem-solution fitFit: Partial Most accounting corrections retain approval and gain history. VAT corrections remain inconsistent or non-atomic, and valid payment-method corrections still require reopening. Status of previous suggestions
S1 (🔴 High): Choose an ID unused by country apps S2 (🔴 High): Reconcile specifications before allowing VAT liability corrections S5 (🔴 High): Failed VAT corrections still change approved reports S4 (🟠 Moderate): Refresh affected duplicate checks after merchant corrections S3 (🟠 Moderate): Payment method corrections still require report reopening S6 (🟠 Moderate): Preserve approved descriptions during account corrections New observations (commits since round 3)None. The test-ID correction introduces no new finding; all six previous suggestions remain open. Risk assessment and necessityRisk: The retained country codeunit declaration prevents compatible Default builds. VAT specifications can post VAT despite a cleared liability flag, and vendor-selection failure can leave a submitted correction committed. The history tests cover successful corrections and posting guards, but not those VAT failure paths. Independent pinned-source checks verified the relevant BaseApp VAT posting and privacy publisher; no missing publisher dependency was found. No build or runtime tests were run. Necessity: Routine accounting corrections should not require reopening and repeating approval. Durable history is justified, but the test-ID correction does not make the remaining production blockers safe.
|
Good Sense Reviewer - Round 5Recommendation: Request ChangesWhat this PR doesAllows accounting corrections after submission without repeating approval, records field history, and transfers that history to the posted report. The new change renumbers the internal change-log manager from 6916 to 6927, removing its conflict with the Canadian dependent app. It does not change VAT correction or posting behavior. Approved specifications can still reclaim VAT after the parent liability flag is cleared, and a failed vendor-selection path still commits the flag and history before the correction succeeds. Problem-solution fitFit: Partial The country-app collision is fixed and most accounting corrections gain history without losing approval. VAT consistency and atomic validation remain unresolved; the other retained findings concern audit completeness and bounded workflow gaps. Status of previous suggestions
S2 (🔴 High): Reconcile specifications before allowing VAT liability corrections S5 (🔴 High): Validate the vendor before committing liability changes S3 (🟠 Moderate): Allow and log type-preserving payment method corrections S4 (🟠 Moderate): Refresh affected duplicate checks after merchant corrections S6 (🟠 Moderate): Preserve approved descriptions during billing account corrections New observations (commits since round 4)None. The only new production span is the codeunit renumbering, which fixes S1. The other observations are retained findings, not new issues attributed to merged base changes. Risk assessment and necessityRisk: The dependent-app object collision is removed. The two remaining High findings concern wrong VAT posting and a correction that survives failed validation. Parent amount recalculation does not reconcile specifications, and history insertion occurs before the vendor-dialog Commit. Existing history tests bypass those validation paths; the Moderate workflow and history findings are not the reason for the blocking recommendation. Necessity: Routine accounting corrections should not repeat submission and approval. Preserving approval with an audit history is appropriate, provided the financial state and failed-correction transaction remain consistent.
|
|
…Bug-640772-accountant-wants-to-change-some-simple-things-like-dimensions
AB#640772