Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: distance - share with accountant #51517

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ function MoneyRequestConfirmationList({
}, [isTypeSplit, translate, payeePersonalDetails, getSplitSectionHeader, splitParticipants, selectedParticipants]);

useEffect(() => {
if (!isDistanceRequest || isMovingTransactionFromTrackExpense) {
if (!isDistanceRequest || (isMovingTransactionFromTrackExpense && !isPolicyExpenseChat)) {
// We don't want to recalculate the distance merchant when moving a transaction from Track Expense to a 1:1 chat.
paultsimura marked this conversation as resolved.
Show resolved Hide resolved
// When moving to a policy chat (e.g. sharing with an accountant), we should recalculate the distance merchant with the policy's rate.
return;
}

Expand All @@ -685,6 +687,7 @@ function MoneyRequestConfirmationList({
translate,
toLocaleDigit,
isDistanceRequest,
isPolicyExpenseChat,
transaction,
transactionID,
action,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
const reportActionOriginalMessage = ReportActionsUtils.getOriginalMessage(reportAction);
const policyID = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.policyID ?? '-1';

if (reportActionOriginalMessage?.movedToReportID) {
return "Moved this expense"; // todo: copy needed

Check failure on line 143 in src/libs/ModifiedExpenseMessage.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Replace `"Moved·this·expense"` with `'Moved·this·expense'`

Check failure on line 143 in src/libs/ModifiedExpenseMessage.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `"Moved·this·expense"` with `'Moved·this·expense'`
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neil-marcellini could we please request a copy for this action?
It's added as the first report action after I share my tracked expense with an accountant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we already have a message like this when moving a manual expense for example? Can we use the same copy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neil-marcellini no, the fallback is shown for those expenses as well:

image


const removalFragments: string[] = [];
const setFragments: string[] = [];
const changeFragments: string[] = [];
Expand Down
10 changes: 9 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,15 @@
* Set custom unit rateID for the transaction draft
*/
function setCustomUnitRateID(transactionID: string, customUnitRateID: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {comment: {customUnit: {customUnitRateID}}});
const isFakeP2PRate = customUnitRateID === CONST.CUSTOM_UNITS.FAKE_P2P_ID;
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {
comment: {
customUnit: {
customUnitRateID,
...!isFakeP2PRate && {defaultP2PRate: null}

Check failure on line 474 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Replace `!isFakeP2PRate·&&·{defaultP2PRate:·null}` with `(!isFakeP2PRate·&&·{defaultP2PRate:·null}),`

Check failure on line 474 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `!isFakeP2PRate·&&·{defaultP2PRate:·null}` with `(!isFakeP2PRate·&&·{defaultP2PRate:·null}),`
},
},
});
}

/** Set the distance rate of a new transaction */
Expand Down
Loading