fix
This commit is contained in:
@@ -26,6 +26,7 @@ let plAccountingMethod = 'Accrual';
|
||||
let bsAsOfDate = null;
|
||||
let bsAccountingMethod = 'Accrual';
|
||||
|
||||
let registerLoadSeq = 0;
|
||||
// ────────────────────────────────────────────────────────────────────
|
||||
// Helpers
|
||||
// ────────────────────────────────────────────────────────────────────
|
||||
@@ -252,11 +253,16 @@ export async function loadRegister() {
|
||||
const slot = 'accounting-register-table';
|
||||
showLoading(slot, 'Loading register from QBO…');
|
||||
|
||||
const mySeq = ++registerLoadSeq; // ← merken, welcher Call das ist
|
||||
|
||||
try {
|
||||
const result = await window.API.accounting.getRegister(
|
||||
registerAccountId, registerStartDate, registerEndDate
|
||||
);
|
||||
|
||||
// Wenn inzwischen ein neuerer Call gestartet wurde → Result verwerfen
|
||||
if (mySeq !== registerLoadSeq) return;
|
||||
|
||||
if (result.error) {
|
||||
showError(slot, result.error);
|
||||
return;
|
||||
@@ -264,6 +270,7 @@ export async function loadRegister() {
|
||||
|
||||
renderRegisterTable(result);
|
||||
} catch (err) {
|
||||
if (mySeq !== registerLoadSeq) return;
|
||||
console.error('Register load failed:', err);
|
||||
showError(slot, err.message || 'Failed to load register');
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ async function getRegister({ accountId, startDate, endDate }) {
|
||||
if (startDate) params.set('start_date', startDate);
|
||||
if (endDate) params.set('end_date', endDate);
|
||||
// account filter: TransactionList akzeptiert eine kommaseparierte Liste
|
||||
params.set('account', String(accountId));
|
||||
params.set('source_account', String(accountId));
|
||||
params.set('minorversion', QBO_MINOR_VERSION);
|
||||
|
||||
const url = `${baseUrl}/v3/company/${companyId}/reports/TransactionList?${params.toString()}`;
|
||||
|
||||
Reference in New Issue
Block a user