Añade botón 'Clear Cart' (fa-trash) en el header y footer del sidebar del carrito en la página de lista de productos. Cambios: - views/website_templates.xml: botón clear-cart-btn en card-header y clear-cart-btn-footer en card-footer del sidebar - controllers/website_sale.py: nuevo endpoint POST /eskaera/clear-cart que cancela el sale.order borrador del usuario si existe - static/src/js/website_sale.js: método _clearCart(), listeners para ambos botones (header + footer) - models/js_translations.py: nuevas cadenas clear_cart, clear_cart_confirm, cart_cleared, draft_cancelled - i18n/es.po, i18n/eu.po: traducciones ES y EU de los nuevos labels
185 lines
5.1 KiB
Python
185 lines
5.1 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
"""
|
|
JavaScript Translation Strings
|
|
|
|
This file ensures that all JavaScript-related translatable strings are imported
|
|
into Odoo's translation system during module initialization.
|
|
|
|
CRITICAL: All strings that are dynamically rendered via JavaScript labels must
|
|
be included here with _() to ensure they are captured by Odoo's translation
|
|
extraction and loaded into the database.
|
|
|
|
See: docs/TRANSLATIONS_MASTER.md - "JavaScript Translations Must Be in js_translations.py"
|
|
"""
|
|
|
|
from odoo import _
|
|
|
|
|
|
def _register_translations():
|
|
"""
|
|
Register all JavaScript translation strings.
|
|
|
|
Called by Odoo's translation extraction system.
|
|
These calls populate the POT/PO files for translation.
|
|
"""
|
|
# ========================
|
|
# Action Labels
|
|
# ========================
|
|
_("Save Cart")
|
|
_("Reload Cart")
|
|
_("Browse Product Categories")
|
|
_("Proceed to Checkout")
|
|
_("Confirm Order")
|
|
_("Back to Cart")
|
|
_("Remove Item")
|
|
_("Add to Cart")
|
|
_("Save as Draft")
|
|
_("Load Draft")
|
|
_("Browse Product Categories")
|
|
|
|
# ========================
|
|
# Draft Modal Labels
|
|
# ========================
|
|
_("Draft Already Exists")
|
|
_("A saved draft already exists for the current order period.")
|
|
_("You have two options:")
|
|
_("Option 1: Merge with Existing Draft")
|
|
_("Combine your current cart with the existing draft.")
|
|
_("Existing draft has")
|
|
_("Current cart has")
|
|
_("item(s)")
|
|
_(
|
|
"Products will be merged by adding quantities. If a product exists in both, quantities will be combined."
|
|
)
|
|
_("Option 2: Replace with Current Cart")
|
|
_("Delete the old draft and save only the current cart items.")
|
|
_("The existing draft will be permanently deleted.")
|
|
_("Merge")
|
|
_("Replace")
|
|
|
|
# ========================
|
|
# Draft Save/Load Confirmations
|
|
# ========================
|
|
_("Are you sure you want to save this cart as draft? Items to save: ")
|
|
_("You will be able to reload this cart later.")
|
|
_("Are you sure you want to load your last saved draft?")
|
|
_("This will replace the current items in your cart")
|
|
_("with the saved draft.")
|
|
|
|
# ========================
|
|
# Cart Messages (All Variations)
|
|
# ========================
|
|
_("Your cart is empty")
|
|
_("This order's cart is empty.")
|
|
_("This order's cart is empty")
|
|
_("added to cart")
|
|
_("items")
|
|
_("Your cart has been restored")
|
|
|
|
# ========================
|
|
# Confirmation & Validation
|
|
# ========================
|
|
_("Confirmation")
|
|
_("Confirm")
|
|
_("Cancel")
|
|
_("Please enter a valid quantity")
|
|
|
|
# ========================
|
|
# Error Messages
|
|
# ========================
|
|
_("Error: Order ID not found")
|
|
_("No draft orders found for the current order period")
|
|
_("Connection error")
|
|
_("Error loading order")
|
|
_("Error loading draft")
|
|
_("Unknown error")
|
|
_("Error saving cart")
|
|
_("Error processing response")
|
|
|
|
# ========================
|
|
# Success Messages
|
|
# ========================
|
|
_("Cart saved as draft successfully")
|
|
_("Draft order loaded successfully")
|
|
_("Draft merged successfully")
|
|
_("Draft replaced successfully")
|
|
_("Order loaded")
|
|
_("Thank you! Your order has been confirmed.")
|
|
_("Quantity updated")
|
|
|
|
# ========================
|
|
# Field Labels
|
|
# ========================
|
|
_("Product")
|
|
_("Supplier")
|
|
_("Price")
|
|
_("Quantity")
|
|
_("Subtotal")
|
|
_("Total")
|
|
|
|
# ========================
|
|
# Checkout Page Labels
|
|
# ========================
|
|
_("Home Delivery")
|
|
_("Delivery Information")
|
|
_(
|
|
"Delivery Information: Your order will be delivered at {pickup_day} {pickup_date}"
|
|
)
|
|
_("Your order will be delivered the day after pickup between 11:00 - 14:00")
|
|
_("Important")
|
|
_(
|
|
"Once you confirm this order, you will not be able to modify it. Please review carefully before confirming."
|
|
)
|
|
|
|
# ========================
|
|
# Search & Filter Labels
|
|
# ========================
|
|
_("Search")
|
|
_("Search products...")
|
|
_("No products found")
|
|
_("Categories")
|
|
_("All categories")
|
|
|
|
# ========================
|
|
# Category Labels
|
|
# ========================
|
|
_("Order Type")
|
|
_("Order Period")
|
|
_("Cutoff Day")
|
|
_("Pickup Day")
|
|
_("Store Pickup Day")
|
|
_("Open until")
|
|
|
|
# ========================
|
|
# Portal Page Labels (New)
|
|
# ========================
|
|
_("Load in Cart")
|
|
_("Consumer Group")
|
|
_("Delivery Information")
|
|
_("Delivery Date:")
|
|
_("Pickup Date:")
|
|
_("Delivery Notice:")
|
|
_("No special delivery instructions")
|
|
_("Pickup Location:")
|
|
|
|
# ========================
|
|
# Day Names (Required for translations)
|
|
# ========================
|
|
_("Monday")
|
|
_("Tuesday")
|
|
_("Wednesday")
|
|
_("Thursday")
|
|
_("Friday")
|
|
_("Saturday")
|
|
_("Sunday")
|
|
|
|
# ========================
|
|
# Clear Cart
|
|
# ========================
|
|
_("Clear Cart")
|
|
_(
|
|
"Are you sure you want to clear the cart? This will also cancel any saved draft order."
|
|
)
|
|
_("Cart cleared")
|
|
_("draft order cancelled")
|