Skip to content

Slice 641293: [Expense Agent] Expense Locations and Per-diem rules in configurationAdded more locations - #10155

Merged
Bardur Knudsen (BardurKnudsen) merged 43 commits into
mainfrom
features/641293-locations
Sep 10, 2026
Merged

Slice 641293: [Expense Agent] Expense Locations and Per-diem rules in configurationAdded more locations#10155
Bardur Knudsen (BardurKnudsen) merged 43 commits into
mainfrom
features/641293-locations

Conversation

@BardurKnudsen

@BardurKnudsen Bardur Knudsen (BardurKnudsen) commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Adds more locations (basically all country/regions) and corresponding expense rule headers and expense rule conditions.

Fixes AB#641293

@BardurKnudsen
Bardur Knudsen (BardurKnudsen) requested a review from a team August 11, 2026 14:56
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Team: Integrations GitHub request for Integrations area labels Aug 11, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Events}$

BuildRuleSeeds and BuildRuleConditionSeeds now delegate straight to the new seed-builder codeunits, so the shipped local integration events OnBeforeAddRuleSeed, OnBeforeInsertRuleSeed, and OnBeforeAddRuleConditionSeed are no longer raised on this code path. Dependent extensions can still subscribe to local publishers, so this refactor breaks the existing subscriber contract unless the new implementation preserves those event raises.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Events}$

The shipped [IntegrationEvent] OnBeforeAddCategorySeed changes its existing PaymentMethod parameter from Code[20] to Code[10]. Even though the publisher is local, subscribers still bind to the parameter's type, so this is a breaking event-contract change. Keep the event signature unchanged and handle the narrower storage requirement inside the publisher logic instead.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

    local procedure OnBeforeAddCategorySeed(Code: Code[20]; Description: Text[250]; PostingDescription: Text[100]; ExpenseGroupCode: Code[20]; PostingGroupCode: Code[20]; PaymentMethod: Code[20]; IsRefundable: Boolean; IsPrepayment: Boolean; AttachmentEnforcement: Enum "Expense Attachment Enforcement"; DetailRequired: Enum "Expense Detail Needed"; var IsHandled: Boolean)

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

Comment thread src/Apps/W1/ExpenseAgent/app/src/Expense/Tables/Expense.Table.al Outdated
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ AppSource}$

This PR adds new setup codeunits — "Create Expense Location" (7104), "Create Expense Rule Condition" (7105), "Create Expense Rule Header" (7107) — which are invoked from "Create Expense Categories"'s setup/defaults flow, but the "Expense Agent - Objects" permission set (which the assignable Expense Agent role includes) grants execute permission for none of them (it only lists "Create Expense Report" among "Create *" codeunits). If any part of the setup/defaults flow runs under the agent user's permission set rather than SUPER, this produces a missing-permission failure. Verify whether these codeunits execute only under an installing/SUPER context; if the agent user can reach this flow, add execute permissions for the three new codeunits.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.33.4

Comment thread src/Apps/W1/ExpenseAgent/app/src/Expense/Tables/Expense.Table.al Outdated
@github-actions github-actions Bot removed the Team: Integrations GitHub request for Integrations area label Sep 9, 2026
@BardurKnudsen

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…ions

Co-authored-by: BardurKnudsen <8470791+BardurKnudsen@users.noreply.github.com>

Copilot AI commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved by merge commit 10889b3d9.

Copilot resolve the merge conflicts in this pull request

Resolved by merge commit 10889b3d9.

@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Sep 9, 2026
@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Sep 9, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 9

Recommendation: Request Changes

What this PR does

This expands the default expense-location catalog and seeds default management rules for per-diem locations. Since round 8, the branch merge brings the PR up to the current base and resolves conflicts in permissions, wizard, and test helper files.

Those merge changes look safe, but they do not change the default location and rule seeders. The current net diff still seeds blank per-diem currency with a fixed daily rate, can create rules for skipped locations, can add generic per-diem rules in AT setup, and can insert default conditions without matching headers.

Status of previous suggestions
ID Title Status Author response
S1 Per-diem defaults lose their currencies and rates Not addressed None. Current seed rows still use blank currency and a fixed 100 daily rate for the default per-diem rules.
S2 Conflicting locations can break Apply default settings Not addressed None. The apply path still creates rule headers and conditions from all rule seeds after skipped locations are removed.
S3 AT per-diem overrides are now ignored Not addressed None. The AT setup still builds generic PER-DIEM rule seeds before adding the country-specific PERDIEMI and PERDIEMA seeds.
S4 Default limits lose their rule headers Not addressed None. The header seeder still exits for existing non-per-diem categories, but the condition seeder can still add their conditions.
S5 Posting skips invalid reimbursement lines Addressed Still addressed. The current code errors when Reimbursement Type is blank instead of allowing release.
New observations (commits since round 8)

None - the latest merge integrates current base changes and conflict resolutions. I did not find a new review finding in those hunks.

Risk assessment and necessity

Risk: The remaining issues can still seed wrong or incomplete management-rule data. This can make default expense setup validate per-diem expenses against wrong rates, create rules for locations that do not exist, leave localized per-diem setup mixed with generic rules, or create conditions without matching rule headers.

Necessity: The wider location catalog and default per-diem setup are useful feature work. The scope is still right, but the seeded locations, headers, conditions, currencies, rates, and country-specific defaults must stay consistent before merge.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10155 round=9 by=alexei-dobriansky at=2026-09-09T13:55:57Z lastSha=10889b3d931d907198c9748934bf8a3c477f3258 reviewKey=950ba7e7733749a03c693b24ceb193263e30365bad7595b8d7f456778252608d suggestions=S1@7e91c4ab:notaddressed,S2@3b2d9f10:notaddressed,S3@8ac0de55:notaddressed,S4@855f4711:notaddressed,S5@fd7ed5cc:addressed parentRound=8

@BardurKnudsen

Copy link
Copy Markdown
Contributor Author

Good Sense Reviewer - Round 9

Recommendation: Request Changes

What this PR does
This expands the default expense-location catalog and seeds default management rules for per-diem locations. Since round 8, the branch merge brings the PR up to the current base and resolves conflicts in permissions, wizard, and test helper files.

Those merge changes look safe, but they do not change the default location and rule seeders. The current net diff still seeds blank per-diem currency with a fixed daily rate, can create rules for skipped locations, can add generic per-diem rules in AT setup, and can insert default conditions without matching headers.

Status of previous suggestions
ID Title Status Author response
S1 Per-diem defaults lose their currencies and rates Not addressed None. Current seed rows still use blank currency and a fixed 100 daily rate for the default per-diem rules.
S2 Conflicting locations can break Apply default settings Not addressed None. The apply path still creates rule headers and conditions from all rule seeds after skipped locations are removed.
S3 AT per-diem overrides are now ignored Not addressed None. The AT setup still builds generic PER-DIEM rule seeds before adding the country-specific PERDIEMI and PERDIEMA seeds.
S4 Default limits lose their rule headers Not addressed None. The header seeder still exits for existing non-per-diem categories, but the condition seeder can still add their conditions.
S5 Posting skips invalid reimbursement lines Addressed Still addressed. The current code errors when Reimbursement Type is blank instead of allowing release.
New observations (commits since round 8)
None - the latest merge integrates current base changes and conflict resolutions. I did not find a new review finding in those hunks.

Risk assessment and necessity
Risk: The remaining issues can still seed wrong or incomplete management-rule data. This can make default expense setup validate per-diem expenses against wrong rates, create rules for locations that do not exist, leave localized per-diem setup mixed with generic rules, or create conditions without matching rule headers.

Necessity: The wider location catalog and default per-diem setup are useful feature work. The scope is still right, but the seeded locations, headers, conditions, currencies, rates, and country-specific defaults must stay consistent before merge.

[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10155 round=9 by=alexei-dobriansky at=2026-09-09T13:55:57Z lastSha=10889b3d931d907198c9748934bf8a3c477f3258 reviewKey=950ba7e7733749a03c693b24ceb193263e30365bad7595b8d7f456778252608d suggestions=S1@7e91c4ab:notaddressed,S2@3b2d9f10:notaddressed,S3@8ac0de55:notaddressed,S4@855f4711:notaddressed,S5@fd7ed5cc:addressed parentRound=8

Alexey (@alexey) Dobriansky: Can you please close this comment?

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Breaking\ Changes}$

The shipped "Contoso Expense Agent".InsertExpense contract was changed in place by narrowing ExpenseLocationCode from Code[30] to Code[20]. This internal procedure is called across app boundaries (e.g. the AT demo-data app's CreateExpenseAT/CreatePostedExpReportAT codeunits), so any dependent that holds a Code[30] value for this parameter loses the published contract. Keep the existing signature and introduce a new/overloaded entry point if the narrower type is required.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.41.6

@BardurKnudsen

Copy link
Copy Markdown
Contributor Author

Good Sense Reviewer - Round 9

Recommendation: Request Changes

What this PR does
This expands the default expense-location catalog and seeds default management rules for per-diem locations. Since round 8, the branch merge brings the PR up to the current base and resolves conflicts in permissions, wizard, and test helper files.

Those merge changes look safe, but they do not change the default location and rule seeders. The current net diff still seeds blank per-diem currency with a fixed daily rate, can create rules for skipped locations, can add generic per-diem rules in AT setup, and can insert default conditions without matching headers.

Status of previous suggestions
ID Title Status Author response
S1 Per-diem defaults lose their currencies and rates Not addressed None. Current seed rows still use blank currency and a fixed 100 daily rate for the default per-diem rules.
S2 Conflicting locations can break Apply default settings Not addressed None. The apply path still creates rule headers and conditions from all rule seeds after skipped locations are removed.
S3 AT per-diem overrides are now ignored Not addressed None. The AT setup still builds generic PER-DIEM rule seeds before adding the country-specific PERDIEMI and PERDIEMA seeds.
S4 Default limits lose their rule headers Not addressed None. The header seeder still exits for existing non-per-diem categories, but the condition seeder can still add their conditions.
S5 Posting skips invalid reimbursement lines Addressed Still addressed. The current code errors when Reimbursement Type is blank instead of allowing release.
New observations (commits since round 8)
None - the latest merge integrates current base changes and conflict resolutions. I did not find a new review finding in those hunks.

Risk assessment and necessity
Risk: The remaining issues can still seed wrong or incomplete management-rule data. This can make default expense setup validate per-diem expenses against wrong rates, create rules for locations that do not exist, leave localized per-diem setup mixed with generic rules, or create conditions without matching rule headers.

Necessity: The wider location catalog and default per-diem setup are useful feature work. The scope is still right, but the seeded locations, headers, conditions, currencies, rates, and country-specific defaults must stay consistent before merge.

[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10155 round=9 by=alexei-dobriansky at=2026-09-09T13:55:57Z lastSha=10889b3d931d907198c9748934bf8a3c477f3258 reviewKey=950ba7e7733749a03c693b24ceb193263e30365bad7595b8d7f456778252608d suggestions=S1@7e91c4ab:notaddressed,S2@3b2d9f10:notaddressed,S3@8ac0de55:notaddressed,S4@855f4711:notaddressed,S5@fd7ed5cc:addressed parentRound=8

Dear agent:
S1: By diem defaults should be in local currency, regardless of where we travel.
S2: By design, as getting default locations is only done during initial setup
S3: AT Per diem override: By design. May be revisited later.
S4: Will be analyzed in a subsequent slice.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Reply

Thanks for the clarification. I am closing the round-9 points.

  • S1 - Agree. The default per-diem rules can use local currency. I withdraw this point.
  • S2 - Agree. If this path is only for initial setup by design, I withdraw this point.
  • S3 - Agree. I accept that the AT per-diem behavior is by design for this slice. I withdraw this point.
  • S4 - Deferred. This will be handled in a later slice, so I will not keep it open on this PR.

The round-9 suggestions are closed.


[AI-PR-REPLY] version=1 promptVersion=4 system=github pr=10155 reviewRound=9 by=alexei-dobriansky at=2026-09-10T08:33:04Z respondsTo=2026-09-10T08:21:11Z reviewKey=950ba7e7733749a03c693b24ceb193263e30365bad7595b8d7f456778252608d

Merged via the queue into main with commit 0e043e4 Sep 10, 2026
498 of 503 checks passed
@BardurKnudsen
Bardur Knudsen (BardurKnudsen) deleted the features/641293-locations branch September 10, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants