@@ -22,7 +22,7 @@ import {
2222 isSelfDM ,
2323 shouldEnableNegative ,
2424} from '@libs/ReportUtils' ;
25- import { calculateTaxAmount , getAmount , getClearedPendingFields , getCurrency , getTaxValue , getUpdatedTransaction , isOnHold } from '@libs/TransactionUtils' ;
25+ import { calculateTaxAmount , getAmount , getClearedPendingFields , getCurrency , getTaxValue , getUpdatedTransaction , isOnHold , isSplitChildTransaction } from '@libs/TransactionUtils' ;
2626import ViolationsUtils from '@libs/Violations/ViolationsUtils' ;
2727import { createTransactionThreadReport } from '@userActions/Report' ;
2828import CONST from '@src/CONST' ;
@@ -150,6 +150,9 @@ function updateMultipleMoneyRequests({
150150 // Category, tag, tax, and billable only apply to expense/invoice reports and unreported (track) expenses.
151151 // For plain IOU transactions these fields are not applicable and must be silently skipped.
152152 const supportsExpenseFields = isUnreportedExpense || isFromExpenseReport || isInvoiceReportReportUtils ( baseIouReport ?? undefined ) ;
153+ // Split children must keep their amount/currency/tax in sync with the split parent's totals.
154+ // Allow coding fields (category, tag, merchant, etc.) but block these so we never put the split out of sync.
155+ const isSplitChild = isSplitChildTransaction ( transaction ) ;
153156 // Use the transaction's own policy for all per-transaction checks (permissions, tax, change-diffing).
154157 // Falls back to the shared bulk-edit policy when the transaction's workspace cannot be resolved.
155158 const transactionPolicy = ( iouReport ?. policyID ? allPolicies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ iouReport . policyID } ` ] : undefined ) ?? policy ;
@@ -171,23 +174,23 @@ function updateMultipleMoneyRequests({
171174 if ( changes . created && canEditField ( CONST . EDIT_REQUEST_FIELD . DATE ) ) {
172175 transactionChanges . created = changes . created ;
173176 }
174- if ( changes . amount !== undefined && canEditField ( CONST . EDIT_REQUEST_FIELD . AMOUNT ) ) {
177+ if ( changes . amount !== undefined && ! isSplitChild && canEditField ( CONST . EDIT_REQUEST_FIELD . AMOUNT ) ) {
175178 transactionChanges . amount = changes . amount ;
176179 }
177180 // When bulk-editing amount on a taxed expense without also changing taxCode, recompute
178181 // taxAmount from the transaction's existing taxCode so offline optimistic data and the
179182 // queued payload stay in sync with the new amount. Skip when the rate can't be resolved
180183 // (e.g. cross-policy bulk edit where the transaction's own policy is missing from cache)
181184 // to avoid silently overwriting a non-zero taxAmount with 0.
182- if ( changes . amount !== undefined && ! changes . taxCode && transaction . taxCode && supportsExpenseFields && canEditField ( CONST . EDIT_REQUEST_FIELD . TAX_RATE ) ) {
185+ if ( changes . amount !== undefined && ! isSplitChild && ! changes . taxCode && transaction . taxCode && supportsExpenseFields && canEditField ( CONST . EDIT_REQUEST_FIELD . TAX_RATE ) ) {
183186 const taxValue = getTaxValue ( transactionPolicy , transaction , transaction . taxCode ) ;
184187 if ( taxValue ) {
185188 const decimals = getCurrencyDecimals ( getCurrency ( transaction ) ) ;
186189 const taxAmount = calculateTaxAmount ( taxValue , Math . abs ( changes . amount ) , decimals ) ;
187190 transactionChanges . taxAmount = convertToBackendAmount ( taxAmount ) ;
188191 }
189192 }
190- if ( changes . currency && canEditField ( CONST . EDIT_REQUEST_FIELD . CURRENCY ) ) {
193+ if ( changes . currency && ! isSplitChild && canEditField ( CONST . EDIT_REQUEST_FIELD . CURRENCY ) ) {
191194 transactionChanges . currency = changes . currency ;
192195 }
193196 if ( changes . category !== undefined && supportsExpenseFields && canEditField ( CONST . EDIT_REQUEST_FIELD . CATEGORY ) ) {
@@ -199,7 +202,7 @@ function updateMultipleMoneyRequests({
199202 if ( changes . comment && canEditField ( CONST . EDIT_REQUEST_FIELD . DESCRIPTION ) ) {
200203 transactionChanges . comment = getParsedComment ( changes . comment ) ;
201204 }
202- if ( changes . taxCode && supportsExpenseFields && canEditField ( CONST . EDIT_REQUEST_FIELD . TAX_RATE ) ) {
205+ if ( changes . taxCode && supportsExpenseFields && ! isSplitChild && canEditField ( CONST . EDIT_REQUEST_FIELD . TAX_RATE ) ) {
203206 transactionChanges . taxCode = changes . taxCode ;
204207 const taxValue = getTaxValue ( transactionPolicy , transaction , changes . taxCode ) ;
205208 transactionChanges . taxValue = taxValue ;
0 commit comments