From 93c6f13325c0a5eb1d8451a53d46838ce8656aa1 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Tue, 16 Jun 2026 16:40:56 +0000 Subject: [PATCH] perf(vat): fetch VAT operations 200/page instead of 50 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The find.outbox endpoint accepts maxCount=200 (verified live: 50->50, 200->200), same as the invoice endpoints, but the VAT fetch was hardcoded to 50 — ~4x more round-trips than necessary. Bump the client page size and the backend defaults to 200; the pagination loop is size-agnostic so logic is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- invoice_az/client/journal_entry.js | 2 +- invoice_az/vat_api.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/invoice_az/client/journal_entry.js b/invoice_az/client/journal_entry.js index 043e953..3ba6a25 100644 --- a/invoice_az/client/journal_entry.js +++ b/invoice_az/client/journal_entry.js @@ -981,7 +981,7 @@ VATETaxes.import = { return; } - const maxCount = 50; + const maxCount = 200; // VAT find.outbox supports 200/page (4x fewer round-trips) frappe.call({ method: 'invoice_az.vat_api.get_vat_operations', diff --git a/invoice_az/vat_api.py b/invoice_az/vat_api.py index f5ff8d3..ace7db8 100644 --- a/invoice_az/vat_api.py +++ b/invoice_az/vat_api.py @@ -74,7 +74,7 @@ def parse_operation_date(operation_date_str): @frappe.whitelist() -def get_vat_operations(token, date_from, date_to, max_count=50, offset=0): +def get_vat_operations(token, date_from, date_to, max_count=200, offset=0): """ Получение списка VAT Account операций из e-taxes @@ -94,7 +94,7 @@ def get_vat_operations(token, date_from, date_to, max_count=50, offset=0): max_count = int(max_count) offset = int(offset) except (ValueError, TypeError): - max_count = 50 + max_count = 200 offset = 0 payload = { @@ -1060,7 +1060,7 @@ def import_vat_operations(operations_data, company=None, create_as_draft=0, auto @frappe.whitelist() -def load_vat_operations_from_etaxes(date_from, date_to, max_count=50, offset=0): +def load_vat_operations_from_etaxes(date_from, date_to, max_count=200, offset=0): """ Загрузка VAT операций из e-taxes (для фронтенда)