Fix showing of billable column when policy exists but defaultBillable isn't present#79421
Fix showing of billable column when policy exists but defaultBillable isn't present#79421JS00001 merged 3 commits intoExpensify:mainfrom
Conversation
|
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@DylanDylann @JS00001 One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@Pujan92 is the C+ on this. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c45285118
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/libs/MoneyRequestReportUtils.ts
Outdated
| function isBillableEnabledOnPolicy(policy: Policy | OnyxEntry<Policy> | undefined): boolean { | ||
| return !!policy && policy.disabledFields?.defaultBillable !== true; | ||
| return !!policy && policy.disabledFields?.defaultBillable === false; |
There was a problem hiding this comment.
Defaulting missing disabledFields to disabled hides billable column
This now returns false when disabledFields.defaultBillable is undefined. disabledFields is optional in the policy schema and other code paths treat a missing value as “not disabled” (e.g., the workspace billable toggle uses ?? false and reimbursable checks treat missing as enabled), so policies that omit this field (older policies or partial Onyx records) will have the billable column hidden even though billable tracking is effectively enabled and billable transactions may exist. That results in a missing column in money request reports for those policies; consider treating undefined as enabled (the prior !== true behavior) to keep this consistent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think the bots correct, if its undefined, then defaultBillable should not be a disabled field.
There was a problem hiding this comment.
Can we come up with another way of doing this?
There was a problem hiding this comment.
Then isn't the bug invalid? The issue was happening because defaultBillable wasn't available in the personal policy I think.
So, if we consider it as true when defined, then the column would show
There was a problem hiding this comment.
I think the bots correct, if its undefined, then defaultBillable should not be a disabled field.
Isn't hiding the billable column correct whenever the policy disabledFields data isn't available?
There was a problem hiding this comment.
Expenses are able to be marked as billable, unless the field is disabled I believe
@ShridharGoel I think that we can add some checks for that. For example, if the policy is a non-corporate policy, then return false.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@JS00001 Please help remove me from this PR |
Pujan92
left a comment
There was a problem hiding this comment.
LGTM!
Screen.Recording.2026-01-13.at.17.57.34.mov
|
@ShridharGoel commented on this solution |
|
@Pujan92 Can you please re-validate this PR against both blockers? |
|
@JS00001 looks fine to me for those blockers. Screen.Recording.2026-01-13.at.22.19.48.mov
We are not showing that column for the non-corporate(team) policy type, even though disabledFields?.defaultBillable is false. Screen.Recording.2026-01-13.at.22.20.50.mov |
|
@ShridharGoel I think that we'd need to check |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.3.1-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.3.1-1 🚀
|
Explanation of Change
Updated
isBillableEnabledOnPolicyto requiredisabledFields.defaultBillable === falseso missing policy fields don’tincorrectly show the column.
Fixed Issues
$ #79418
$ #79413
PROPOSAL:
Tests
Offline tests
QA Steps
Same.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-01-13.at.12.55.39.PM.mov