diff --git a/jey_erp/hooks.py b/jey_erp/hooks.py index 4caab6b..fbf1241 100644 --- a/jey_erp/hooks.py +++ b/jey_erp/hooks.py @@ -9,15 +9,12 @@ app_license = "unlicense" boot_session = "jey_erp.extend_party_types.apply_vat_boot_patches" app_include_js = [ - "/assets/jey_erp/js/vat_calculator.js", - "/assets/jey_erp/js/sales_invoice.js", - "/assets/jey_erp/js/sales_invoice_vat.js", - "/assets/jey_erp/js/sales_invoice_tax_articles.js", - "/assets/jey_erp/js/sales_invoice_certificates.js", - "/assets/jey_erp/js/sales_order_vat.js", - "/assets/jey_erp/js/asset.js", - "/assets/jey_erp/js/link_field_fix.js", - "bank_excel_import.bundle.js", + # Desk-wide scripts ONLY. Every entry here is appended to the desk's + # `Link: rel=preload` response header; the edge proxy has a ~4 KB header + # buffer and overflowing it returns 502 (see jey_layout/hooks.py). Keep this + # list minimal — form-specific scripts belong in doctype_js below. + "/assets/jey_erp/js/link_field_fix.js", # global link-field patch + "bank_excel_import.bundle.js", # launched from Bank Transaction list + Reconciliation Tool ] app_include_css = [ @@ -26,11 +23,24 @@ app_include_css = [ ] doctype_js = { - # sales_classification.js loaded via doctype_js (NOT app_include_js) so it - # does NOT bloat the desk's `Link: rel=preload` header — the edge proxy has a - # 4 KB header buffer and overflowing it returns 502. See jey_layout/hooks.py. - "Sales Invoice": ["public/js/sales_invoice.js", "public/js/sales_classification.js"], - "Sales Order": "public/js/sales_classification.js", + # Form-specific scripts load here (NOT app_include_js) so they never enter the + # desk `Link: rel=preload` header — the edge proxy has a ~4 KB buffer and + # overflowing it returns 502 (see jey_layout/hooks.py). + # ORDER MATTERS: vat_calculator.js defines jey_erp.vat_calculator and the + # *_vat.js scripts call .init() at load time, so it must be listed first. + "Sales Invoice": [ + "public/js/vat_calculator.js", + "public/js/sales_invoice_vat.js", + "public/js/sales_invoice_tax_articles.js", + "public/js/sales_invoice_certificates.js", + "public/js/sales_classification.js", + ], + "Sales Order": [ + "public/js/vat_calculator.js", + "public/js/sales_order_vat.js", + "public/js/sales_classification.js", + ], + "Asset": "public/js/asset.js", "Purchase Invoice": "public/js/purchase_invoice.js", "Employee": "public/js/employee.js", "Bank Reconciliation Tool": "public/js/bank_reconciliation_tool.js", diff --git a/jey_erp/public/js/sales_invoice.js b/jey_erp/public/js/sales_invoice.js deleted file mode 100644 index e69de29..0000000