[FIX] website_sale_aplicoop: drop dead /eskaera/labels fetch, quiet a log
The "Available Orders" page fetched /eskaera/labels with no request body against a type="json" route, which Odoo can't parse (400 "Invalid JSON data" on every load). The script also targeted #realtime-category-select, an element that only exists on the shop page, so it never did anything useful there anyway: the shop page already re-translates that option via _initializeTooltips() in website_sale.js. Delete the dead script instead of fixing a call that was never reachable. infinite_scroll.js also logged console.error for the expected case of running on a page with no product grid (this script loads site-wide); downgrade to console.log since it's not an error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
6a59d9f6ad
commit
96b2e8eedd
2 changed files with 4 additions and 39 deletions
|
|
@ -132,9 +132,10 @@ console.log("[INFINITE_SCROLL] Script loaded!");
|
||||||
console.log("[INFINITE_SCROLL] eskaera-config element:", configEl);
|
console.log("[INFINITE_SCROLL] eskaera-config element:", configEl);
|
||||||
|
|
||||||
if (!configEl) {
|
if (!configEl) {
|
||||||
console.error(
|
// Expected on every eskaera page that has no product grid
|
||||||
"[INFINITE_SCROLL] ❌ No eskaera-config found, lazy loading disabled"
|
// (orders list, checkout, ...): this script is loaded
|
||||||
);
|
// site-wide, not just on the shop page.
|
||||||
|
console.log("[INFINITE_SCROLL] No eskaera-config found, lazy loading disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,42 +69,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
// console.log('[eskaera_page] Loading translated labels for category selector');
|
|
||||||
|
|
||||||
// Fetch translated labels from endpoint
|
|
||||||
fetch('/eskaera/labels', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRFToken': odoo.csrf_token || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
var labels = data.result || data;
|
|
||||||
//console.log('[eskaera_page] Labels received:', labels);
|
|
||||||
|
|
||||||
// Update category selector first option text
|
|
||||||
var categorySelect = document.getElementById('realtime-category-select');
|
|
||||||
if (categorySelect && categorySelect.options[0] && labels && labels.all_categories) {
|
|
||||||
categorySelect.options[0].text = labels.all_categories;
|
|
||||||
// console.log('[eskaera_page] Updated category selector to:', labels.all_categories);
|
|
||||||
} else {
|
|
||||||
console.log('[eskaera_page] Could not update category selector');
|
|
||||||
console.log(' categorySelect:', !!categorySelect);
|
|
||||||
console.log(' categorySelect.options[0]:', categorySelect ? !!categorySelect.options[0] : false);
|
|
||||||
console.log(' labels:', !!labels);
|
|
||||||
console.log(' labels.all_categories:', labels ? labels.all_categories : 'N/A');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('[eskaera_page] Error fetching labels:', error);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
<template id="eskaera_order_card_meta" name="Order Card Metadata">
|
<template id="eskaera_order_card_meta" name="Order Card Metadata">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue