From 1c45285118d8bd73240c69367d5a78404c2fbff9 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:53:44 +0530 Subject: [PATCH 1/3] Fix showing of billable column when policy exists but disabledFields doesn't --- src/libs/MoneyRequestReportUtils.ts | 2 +- tests/unit/MoneyRequestReportUtilsTest.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libs/MoneyRequestReportUtils.ts b/src/libs/MoneyRequestReportUtils.ts index d13346df710b..5e8902a609df 100644 --- a/src/libs/MoneyRequestReportUtils.ts +++ b/src/libs/MoneyRequestReportUtils.ts @@ -19,7 +19,7 @@ import { import {getReimbursable, isTransactionPendingDelete} from './TransactionUtils'; function isBillableEnabledOnPolicy(policy: Policy | OnyxEntry | undefined): boolean { - return !!policy && policy.disabledFields?.defaultBillable !== true; + return !!policy && policy.disabledFields?.defaultBillable === false; } function hasNonReimbursableTransactions(transactions: Transaction[]): boolean { diff --git a/tests/unit/MoneyRequestReportUtilsTest.ts b/tests/unit/MoneyRequestReportUtilsTest.ts index 347d794c4822..b714e467b839 100644 --- a/tests/unit/MoneyRequestReportUtilsTest.ts +++ b/tests/unit/MoneyRequestReportUtilsTest.ts @@ -149,7 +149,7 @@ describe('MoneyRequestReportUtils', () => { expect(isBillableEnabledOnPolicy(undefined)).toBe(false); }); - test('returns true when defaultBillable is not disabled', () => { + test('returns true when defaultBillable is enabled', () => { const policy = {disabledFields: {defaultBillable: false}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(true); }); @@ -158,6 +158,11 @@ describe('MoneyRequestReportUtils', () => { const policy = {disabledFields: {defaultBillable: true}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(false); }); + + test('returns false when defaultBillable is missing', () => { + const policy = {disabledFields: {}} as unknown as Policy; + expect(isBillableEnabledOnPolicy(policy)).toBe(false); + }); }); describe('hasNonReimbursableTransactions', () => { From 82a2c3ce0d95371a0842084b2da1601c645c546e Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Tue, 13 Jan 2026 20:06:29 +0530 Subject: [PATCH 2/3] Update to include coroporate policy condition --- src/libs/MoneyRequestReportUtils.ts | 2 +- tests/unit/MoneyRequestReportUtilsTest.ts | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libs/MoneyRequestReportUtils.ts b/src/libs/MoneyRequestReportUtils.ts index 5e8902a609df..ef5b6bd387ac 100644 --- a/src/libs/MoneyRequestReportUtils.ts +++ b/src/libs/MoneyRequestReportUtils.ts @@ -19,7 +19,7 @@ import { import {getReimbursable, isTransactionPendingDelete} from './TransactionUtils'; function isBillableEnabledOnPolicy(policy: Policy | OnyxEntry | undefined): boolean { - return !!policy && policy.disabledFields?.defaultBillable === false; + return !!policy && policy.type === CONST.POLICY.TYPE.CORPORATE && policy.disabledFields?.defaultBillable !== true; } function hasNonReimbursableTransactions(transactions: Transaction[]): boolean { diff --git a/tests/unit/MoneyRequestReportUtilsTest.ts b/tests/unit/MoneyRequestReportUtilsTest.ts index b714e467b839..f33b01c86e51 100644 --- a/tests/unit/MoneyRequestReportUtilsTest.ts +++ b/tests/unit/MoneyRequestReportUtilsTest.ts @@ -149,18 +149,23 @@ describe('MoneyRequestReportUtils', () => { expect(isBillableEnabledOnPolicy(undefined)).toBe(false); }); - test('returns true when defaultBillable is enabled', () => { - const policy = {disabledFields: {defaultBillable: false}} as unknown as Policy; + test('returns true when policy is corporate and defaultBillable is enabled', () => { + const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {defaultBillable: false}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(true); }); - test('returns false when defaultBillable is disabled', () => { - const policy = {disabledFields: {defaultBillable: true}} as unknown as Policy; + test('returns true when policy is corporate and defaultBillable is missing', () => { + const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {}} as unknown as Policy; + expect(isBillableEnabledOnPolicy(policy)).toBe(true); + }); + + test('returns false when policy is corporate and defaultBillable is disabled', () => { + const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {defaultBillable: true}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(false); }); - test('returns false when defaultBillable is missing', () => { - const policy = {disabledFields: {}} as unknown as Policy; + test('returns false when policy is non-corporate', () => { + const policy = {type: CONST.POLICY.TYPE.TEAM, disabledFields: {defaultBillable: false}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(false); }); }); From b3e62e2c97b5742f6796bf9886859e8faa90a614 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Tue, 13 Jan 2026 23:06:26 +0530 Subject: [PATCH 3/3] Update to check paid group policy --- src/libs/MoneyRequestReportUtils.ts | 3 ++- tests/unit/MoneyRequestReportUtilsTest.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libs/MoneyRequestReportUtils.ts b/src/libs/MoneyRequestReportUtils.ts index ef5b6bd387ac..264ecb724d63 100644 --- a/src/libs/MoneyRequestReportUtils.ts +++ b/src/libs/MoneyRequestReportUtils.ts @@ -4,6 +4,7 @@ import type {TransactionListItemType} from '@components/SelectionListWithSection import CONST from '@src/CONST'; import type {OriginalMessageIOU, Policy, Report, ReportAction, ReportMetadata, Transaction} from '@src/types/onyx'; import {convertToDisplayString} from './CurrencyUtils'; +import {isPaidGroupPolicy} from './PolicyUtils'; import {getIOUActionForTransactionID, getOriginalMessage, isDeletedAction, isDeletedParentAction, isMoneyRequestAction} from './ReportActionsUtils'; import { getMoneyRequestSpendBreakdown, @@ -19,7 +20,7 @@ import { import {getReimbursable, isTransactionPendingDelete} from './TransactionUtils'; function isBillableEnabledOnPolicy(policy: Policy | OnyxEntry | undefined): boolean { - return !!policy && policy.type === CONST.POLICY.TYPE.CORPORATE && policy.disabledFields?.defaultBillable !== true; + return !!policy && isPaidGroupPolicy(policy) && policy.disabledFields?.defaultBillable !== true; } function hasNonReimbursableTransactions(transactions: Transaction[]): boolean { diff --git a/tests/unit/MoneyRequestReportUtilsTest.ts b/tests/unit/MoneyRequestReportUtilsTest.ts index f33b01c86e51..3e33207dbc16 100644 --- a/tests/unit/MoneyRequestReportUtilsTest.ts +++ b/tests/unit/MoneyRequestReportUtilsTest.ts @@ -149,23 +149,23 @@ describe('MoneyRequestReportUtils', () => { expect(isBillableEnabledOnPolicy(undefined)).toBe(false); }); - test('returns true when policy is corporate and defaultBillable is enabled', () => { - const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {defaultBillable: false}} as unknown as Policy; + test('returns true when policy is paid group and defaultBillable is enabled', () => { + const policy = {type: CONST.POLICY.TYPE.TEAM, disabledFields: {defaultBillable: false}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(true); }); - test('returns true when policy is corporate and defaultBillable is missing', () => { + test('returns true when policy is paid group and defaultBillable is missing', () => { const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(true); }); - test('returns false when policy is corporate and defaultBillable is disabled', () => { - const policy = {type: CONST.POLICY.TYPE.CORPORATE, disabledFields: {defaultBillable: true}} as unknown as Policy; + test('returns false when policy is paid group and defaultBillable is disabled', () => { + const policy = {type: CONST.POLICY.TYPE.TEAM, disabledFields: {defaultBillable: true}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(false); }); - test('returns false when policy is non-corporate', () => { - const policy = {type: CONST.POLICY.TYPE.TEAM, disabledFields: {defaultBillable: false}} as unknown as Policy; + test('returns false when policy is non-paid group', () => { + const policy = {type: CONST.POLICY.TYPE.PERSONAL, disabledFields: {defaultBillable: false}} as unknown as Policy; expect(isBillableEnabledOnPolicy(policy)).toBe(false); }); });