diff --git a/src/app/core/models/xero/xero-configuration/clone-setting.model.ts b/src/app/core/models/xero/xero-configuration/clone-setting.model.ts index fd5275fd8..e06ad7ed4 100644 --- a/src/app/core/models/xero/xero-configuration/clone-setting.model.ts +++ b/src/app/core/models/xero/xero-configuration/clone-setting.model.ts @@ -24,6 +24,12 @@ export class XeroCloneSettingModel { const importSettingPayload = XeroImportSettingModel.constructPayload(importSettingForm); const advancedSettingPayload = XeroAdvancedSettingModel.constructPayload(advancedSettingForm); + // Set the bank_account in the payload to the selected field value without formatting it + // Since we format them on component init (clone settings only) + exportSettingPayload.general_mappings.bank_account = exportSettingForm.get('bankAccount')?.value; + importSettingPayload.general_mappings.default_tax_code = importSettingForm.get('defaultTaxCode')?.value; + advancedSettingPayload.general_mappings.payment_account = advancedSettingForm.get('billPaymentAccount')?.value; + if (!isTaxGroupSyncAllowed) { importSettingPayload.workspace_general_settings.import_tax_codes = false; } diff --git a/src/app/integrations/xero/xero-onboarding/xero-clone-settings/xero-clone-settings.component.ts b/src/app/integrations/xero/xero-onboarding/xero-clone-settings/xero-clone-settings.component.ts index 3d7eb24ff..6c78a9988 100644 --- a/src/app/integrations/xero/xero-onboarding/xero-clone-settings/xero-clone-settings.component.ts +++ b/src/app/integrations/xero/xero-onboarding/xero-clone-settings/xero-clone-settings.component.ts @@ -365,6 +365,20 @@ export class XeroCloneSettingsComponent implements OnInit { this.advancedSettingForm = XeroAdvancedSettingModel.mapAPIResponseToFormGroup(this.cloneSetting.advanced_settings, this.adminEmails, destinationAttributes.BANK_ACCOUNT); this.setupAdvancedSettingFormWatcher(); + // Convert field values from destination attributes to *default* destination attributes + const controls = [ + this.exportSettingForm.get('bankAccount'), + this.importSettingForm.get('defaultTaxCode'), + this.advancedSettingForm.get('billPaymentAccount') + ]; + + for (const control of controls) { + const fullDestinationAttribute: DestinationAttribute | null = control?.value; + control?.setValue( + fullDestinationAttribute && ExportSettingModel.formatGeneralMappingPayload(fullDestinationAttribute) + ); + } + this.isLoading = false; }); }