[IMP] website_sale_aplicoop: improve i18n label fallbacks and response parsing

Add hardcoded fallback translations for es/eu when PO-based translation
returns the source string unchanged. Expand labels dict with all keys
needed by the frontend. Fix JSON response parsing in template
(data.result || data). Add js_translations keys. Add pot file for
stock_picking_batch_custom.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
GitHub Copilot 2026-05-25 12:28:33 +02:00
parent 647438e012
commit 5eea3e2a23
7 changed files with 346 additions and 20 deletions

View file

@ -0,0 +1,228 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_batch_custom
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-05-21 13:17+0000\n"
"PO-Revision-Date: 2026-05-21 13:17+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: stock_picking_batch_custom
#: model:ir.model.fields.selection,name:stock_picking_batch_custom.selection__res_company__batch_detailed_restriction_scope__all
msgid "All detailed lines"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields.selection,name:stock_picking_batch_custom.selection__res_company__batch_summary_restriction_scope__all
msgid "All summary products"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_stock_backorder_confirmation
msgid "Backorder Confirmation"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__batch_id
msgid "Batch"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking__batch_consumer_group_id
msgid "Batch Consumer Group"
msgstr ""
#. module: stock_picking_batch_custom
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_custom.res_config_settings_view_form_inherit_batch_custom
msgid "Batch Detailed Operations Restriction"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_stock_picking_batch_summary_line
msgid "Batch Product Summary Line"
msgstr ""
#. module: stock_picking_batch_custom
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_custom.res_config_settings_view_form_inherit_batch_custom
msgid "Batch Product Summary Restriction"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_stock_picking_batch
msgid "Batch Transfer"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_move_line__is_collected
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__is_collected
msgid "Collected"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_res_company
msgid "Companies"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: stock_picking_batch_custom
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_custom.res_config_settings_view_form_inherit_batch_custom
msgid "Configuración de restricciones para la pestaña Operaciones Detalladas."
msgstr ""
#. module: stock_picking_batch_custom
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_custom.res_config_settings_view_form_inherit_batch_custom
msgid "Configuración de restricciones para la pestaña Product Summary."
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_move_line__consumer_group_id
msgid "Consumer Group"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__create_uid
msgid "Created by"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__create_date
msgid "Created on"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__qty_demanded
msgid "Demanded Quantity"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_company__batch_detailed_restriction_scope
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_config_settings__batch_detailed_restriction_scope
msgid "Detailed Operations Restriction Scope"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__display_name
msgid "Display Name"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__qty_done
msgid "Done Quantity"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_company__batch_detailed_restriction_enabled
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_config_settings__batch_detailed_restriction_enabled
msgid "Enforce Detailed Operations Restriction"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_company__batch_summary_restriction_enabled
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_config_settings__batch_summary_restriction_enabled
msgid "Enforce Product Summary Restriction"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_move_line__home_delivery
msgid "Home Delivery"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__id
msgid "ID"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__write_uid
msgid "Last Updated by"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__write_date
msgid "Last Updated on"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields.selection,name:stock_picking_batch_custom.selection__res_company__batch_detailed_restriction_scope__processed
msgid "Only processed lines"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields.selection,name:stock_picking_batch_custom.selection__res_company__batch_summary_restriction_scope__processed
msgid "Only processed products"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__qty_pending
msgid "Pending Quantity"
msgstr ""
#. module: stock_picking_batch_custom
#. odoo-python
#: code:addons/stock_picking_batch_custom/models/stock_picking_batch.py:0
msgid "Pending products: %(products)s"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__product_id
msgid "Product"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__product_categ_id
msgid "Product Category"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_move_line__product_categ_id
msgid "Product Category (Batch)"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch__summary_line_ids
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_custom.view_stock_picking_batch_form_inherit_summary
msgid "Product Summary"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_company__batch_summary_restriction_scope
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_res_config_settings__batch_summary_restriction_scope
msgid "Product Summary Restriction Scope"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.constraint,message:stock_picking_batch_custom.constraint_stock_picking_batch_summary_line_product_required
msgid "Product is required for summary lines."
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model,name:stock_picking_batch_custom.model_stock_picking
msgid "Transfer"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,field_description:stock_picking_batch_custom.field_stock_picking_batch_summary_line__product_uom_id
msgid "Unit of Measure"
msgstr ""
#. module: stock_picking_batch_custom
#: model:ir.model.fields,help:stock_picking_batch_custom.field_stock_move_line__home_delivery
msgid "Whether this picking includes home delivery (from sale order)"
msgstr ""

View file

@ -43,15 +43,89 @@ def _get_translated_labels(self, lang=None, request_obj=None):
lang = _get_detected_language(self, request_obj=req)
env_lang = req.env(context=dict(req.env.context, lang=lang))
lang_code = (lang or "").split("_")[0]
fallbacks = {
"es": {
"Browse Product Categories": "Explorar categorías de productos",
"Save Draft": "Grabar pedido",
"Save order as draft": "Grabar pedido",
"Order saved as draft": "Pedido grabado",
"This order's cart is empty.": "El carrito de este pedido está vacío.",
"This order's cart is empty": "El carrito de este pedido está vacío",
},
"eu": {
"Browse Product Categories": "Produktu kategoriak arakatu",
"Save Draft": "Eskaera gorde",
"Save order as draft": "Eskaera gorde",
"Order saved as draft": "Eskaera gordeta",
"This order's cart is empty.": "Eskaera honen saskia hutsik dago.",
"This order's cart is empty": "Eskaera honen saskia hutsik dago",
},
}
def tr(source):
translated = env_lang._(source)
if translated == source:
translated = fallbacks.get(lang_code, {}).get(source, translated)
return translated
labels = {
"product": env_lang._("Product"),
"quantity": env_lang._("Quantity"),
"price": env_lang._("Price"),
"subtotal": env_lang._("Subtotal"),
"total": env_lang._("Total"),
"empty": env_lang._("This order's cart is empty."),
# ... keep minimal set here; website_sale.py will fall back if needed
"product": tr("Product"),
"quantity": tr("Quantity"),
"price": tr("Price"),
"subtotal": tr("Subtotal"),
"total": tr("Total"),
"empty": tr("This order's cart is empty."),
"empty_cart": tr("This order's cart is empty."),
"browse_categories": tr("Browse Product Categories"),
"all_categories": tr("Browse Product Categories"),
"save_draft": tr("Save Draft"),
"save_order_as_draft": tr("Save order as draft"),
"order_saved_as_draft": tr("Order saved as draft"),
"save_cart": tr("Save Cart"),
"reload_cart": tr("Reload Cart"),
"proceed_to_checkout": tr("Proceed to Checkout"),
"confirm_order": tr("Confirm Order"),
"back_to_cart": tr("Back to Cart"),
"remove_item": tr("Remove Item"),
"cancel": tr("Cancel"),
"confirm": tr("Confirm"),
"confirmation": tr("Confirmation"),
"items": tr("items"),
"items_placeholder": tr("items"),
"added_to_cart": tr("added to cart"),
"cart_restored": tr("Your cart has been restored"),
"order_loaded": tr("Order loaded"),
"invalid_quantity": tr("Please enter a valid quantity"),
"connection_error": tr("Connection error"),
"error_unknown": tr("Unknown error"),
"error_saving_draft": tr("Error saving cart"),
"error_loading_draft": tr("Error loading draft"),
"error_processing_response": tr("Error processing response"),
"draft_saved": tr("Order saved as draft"),
"draft_saved_success": tr("Cart saved as draft successfully"),
"draft_loaded_success": tr("Draft order loaded successfully"),
"reload_draft_confirm": tr(
"Are you sure you want to load your last saved draft?"
),
"reload_draft_replace": tr("This will replace the current items in your cart"),
"reload_draft_with": tr("with the saved draft."),
"clear_cart_confirm": tr(
"Are you sure you want to clear the cart? This will also cancel any saved draft order."
),
"cart_cleared": tr("Cart cleared"),
"draft_cancelled": tr("draft order cancelled"),
"home_delivery": tr("Home Delivery"),
"delivery_information": tr("Delivery Information"),
"delivery_info_template": tr(
"Delivery Information: Your order will be delivered at {pickup_day} {pickup_date}"
),
"important": tr("Important"),
"confirm_order_warning": tr(
"Once you confirm this order, you will not be able to modify it. Please review carefully before confirming."
),
"pickup_day_label": tr("Pickup Day"),
}
return labels

View file

@ -308,7 +308,7 @@ msgstr "Quincenal"
#. odoo-python
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Browse Product Categories"
msgstr "Explorar Categorías de Productos"
msgstr "Explorar categorías de productos"
#. module: website_sale_aplicoop
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_page
@ -725,7 +725,8 @@ msgid ""
"Delivery Information: Your order will be delivered at {pickup_day} "
"{pickup_date}"
msgstr ""
"Información de Entrega en Domicilio: Tu pedido será entregado el {pickup_day} {pickup_date}"
"Información de Entrega en Domicilio: Tu pedido será entregado el "
"{pickup_day} {pickup_date}"
#. module: website_sale_aplicoop
#: model:ir.model.fields,field_description:website_sale_aplicoop.field_group_order__delivery_notice
@ -1535,7 +1536,7 @@ msgstr "Referencia del Pedido"
#. odoo-python
#: code:addons/website_sale_aplicoop/controllers/website_sale.py:0
msgid "Order saved as draft"
msgstr "Pedido guardado como borrador"
msgstr "Pedido grabado"
#. module: website_sale_aplicoop
#: model:product.ribbon,name:website_sale_aplicoop.out_of_stock_ribbon
@ -1884,7 +1885,7 @@ msgstr "Guardar Carrito"
#. odoo-python
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save as Draft"
msgstr "Guardar como Borrador"
msgstr "Grabar pedido"
#. module: website_sale_aplicoop
#. odoo-python
@ -2263,3 +2264,13 @@ msgstr "con el borrador guardado."
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_shop_products
msgid "{{ product.name }}"
msgstr "{{ product.name }}"
#. module: website_sale_aplicoop
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save Draft"
msgstr "Grabar pedido"
#. module: website_sale_aplicoop
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save order as draft"
msgstr "Grabar pedido"

View file

@ -309,7 +309,7 @@ msgstr "Bi-astean behin"
#. odoo-python
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Browse Product Categories"
msgstr "Produktu Kategoriak Arakatu"
msgstr "Produktu kategoriak arakatu"
#. module: website_sale_aplicoop
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_page
@ -723,8 +723,8 @@ msgid ""
"Delivery Information: Your order will be delivered at {pickup_day} "
"{pickup_date}"
msgstr ""
"Etxean Entrega Informazioa: Zure eskaera honakoan entregatuko da {pickup_day} "
"{pickup_date}"
"Etxean Entrega Informazioa: Zure eskaera honakoan entregatuko da "
"{pickup_day} {pickup_date}"
#. module: website_sale_aplicoop
#: model:ir.model.fields,field_description:website_sale_aplicoop.field_group_order__delivery_notice
@ -1533,7 +1533,7 @@ msgstr "Eskaera erreferentzia"
#. odoo-python
#: code:addons/website_sale_aplicoop/controllers/website_sale.py:0
msgid "Order saved as draft"
msgstr "Eskaera zirriborro gisa gordeta"
msgstr "Eskaera gordeta"
#. module: website_sale_aplicoop
#: model:product.ribbon,name:website_sale_aplicoop.out_of_stock_ribbon
@ -1882,7 +1882,7 @@ msgstr "Saskia Gorde"
#. odoo-python
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save as Draft"
msgstr "Zirriborro Gisa Gorde"
msgstr "Eskaera gorde"
#. module: website_sale_aplicoop
#. odoo-python
@ -2047,14 +2047,14 @@ msgstr "Hurrengo ziklorako esleitutako bilketa-tartea (kalkulatua)"
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_checkout_summary
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_shop
msgid "This order's cart is empty"
msgstr "Eskaera honen saskia hutsean dago"
msgstr "Eskaera honen saskia hutsik dago"
#. module: website_sale_aplicoop
#. odoo-python
#: code:addons/website_sale_aplicoop/controllers/website_sale_i18n.py:0
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "This order's cart is empty."
msgstr "Eskaera honen saskia hutsean dago."
msgstr "Eskaera honen saskia hutsik dago."
#. module: website_sale_aplicoop
#. odoo-python
@ -2263,3 +2263,13 @@ msgstr "gordetako zirriborroarekin."
#: model_terms:ir.ui.view,arch_db:website_sale_aplicoop.eskaera_shop_products
msgid "{{ product.name }}"
msgstr "{{ product.name }}"
#. module: website_sale_aplicoop
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save Draft"
msgstr "Eskaera gorde"
#. module: website_sale_aplicoop
#: code:addons/website_sale_aplicoop/models/js_translations.py:0
msgid "Save order as draft"
msgstr "Eskaera gorde"

View file

@ -35,6 +35,8 @@ def _register_translations():
_("Remove Item")
_("Add to Cart")
_("Save as Draft")
_("Save Draft")
_("Save order as draft")
_("Load Draft")
_("Browse Product Categories")

View file

@ -601,7 +601,7 @@
var tooltipMap = {
"save-cart-btn": "save_cart",
"reload-cart-btn": "reload_cart",
"confirm-order-btn": "save_cart",
"confirm-order-btn": "save_draft",
"remove-from-cart": "remove_item",
};

View file

@ -83,7 +83,8 @@
}
})
.then(response =&gt; response.json())
.then(labels =&gt; {
.then(data =&gt; {
var labels = data.result || data;
//console.log('[eskaera_page] Labels received:', labels);
// Update category selector first option text