addons-cm/website_sale_aplicoop/views/portal_templates.xml
GitHub Copilot 5de7573fba [IMP] website_sale_aplicoop: accessibility and responsive polish — phase 8
Quantity control layout: changed from wrapping flex to deliberate two-row
grid so the add-to-cart button sits full-width underneath the stepper,
avoiding accidental line breaks and giving the primary action more pulsing
area. Also removed the /Kg suffix's redundant font rules.

Order card delivery row: reordered to badge-then-date (visually centred),
removed the "Delivery" label, and swapped bg-primary to text-bg-primary for
proper contrast on the home-delivery badge (3.13:1 minimum).

Tooltip translations: moved hardcoded static tooltips from data-bs-title
(untranslatable) to title (QWeb-translatable). Handled the edge case of
"Save Cart" and "Back to Cart" which had translations but no model_terms
reference in the POT, causing the merge to discard them — added the view
reference so translations now apply.

Load-from-history page: added accessibility: a visible status message
("Loading your order…"), a <noscript> fallback with link to the group
order, lang and viewport meta tags, and localised strings for all three
languages. Gave the page a minimal inline style block since it does not
inherit the token system (no website.layout).

Translations: 11 new entries (es/eu/ca) for new/reworded UI strings, plus
two code catalogue entries (products found, Close) that needed the
#. odoo-python comment for _() resolution. Documented the silent-failure
pattern in docs/TRANSLATIONS.md: the POT merge, untranslatable attributes,
and missing code comments.

Tests: 246 passing. Pre-commit: clean.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-16 11:34:38 +02:00

123 lines
7.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Extend portal_my_orders to add group order name and pickup day columns -->
<template id="portal_my_orders_extend" inherit_id="sale.portal_my_orders" name="My Orders - Add Group Order Info">
<!-- Add column headers for new info.
There is no "Actions" header here: the matching <td> below is
commented out, so declaring it left every row one cell short of
its header row and pushed the columns out of alignment. -->
<xpath expr="//tr[hasclass('active')]//th[last()]" position="after">
<th scope="col">Group Order</th>
<th scope="col">Pickup Day</th>
</xpath>
<!-- Add data cells for each order row -->
<xpath expr="//t[@t-foreach='orders']//tr//td[last()]" position="after">
<td>
<t t-if="order.group_order_id">
<t t-esc="order.group_order_id.name"/>
</t>
<t t-else="">
</t>
</td>
<td>
<t t-if="order.group_order_id">
<t t-set="pickup_day" t-value="order.group_order_id.pickup_day"/>
<t t-if="pickup_day is not None and day_names">
<t t-esc="day_names[int(pickup_day) % 7]"/>
</t>
</t>
<t t-else="">
</t>
</td>
<!-- Action buttons disabled
<td class="text-center">
<t t-if="order.group_order_id">
<a t-attf-href="/eskaera/#{order.group_order_id.id}/load-from-history/#{order.id}"
class="btn btn-sm btn-primary me-1"
t-att-title="'Load order items into cart' if order.state == 'draft' else 'Create new order from this one'">
<i class="fa fa-cart-arrow-down"></i>
</a>
<t t-if="order.state == 'draft'">
<a t-attf-href="/eskaera/#{order.group_order_id.id}/checkout"
class="btn btn-sm btn-success"
title="Go to checkout to review and confirm order">
<i class="fa fa-check"></i>
</a>
</t>
</t>
</td> -->
</xpath>
</template>
<!-- Add Load in Cart button to sidebar -->
<!-- deshabilitado, da problemas en la recarga con productos no disponibles y cambios de precios
<template id="portal_order_page_sidebar_button" inherit_id="sale.sale_order_portal_template" name="Order Page - Add Load in Cart Button">
<xpath expr="//div[@id='sale_order_sidebar_button']" position="inside">
<t t-if="sale_order.group_order_id">
<a t-attf-href="/eskaera/#{sale_order.group_order_id.id}/load-from-history/#{sale_order.id}"
class="btn btn-primary" role="button">
<i class="fa fa-cart-arrow-down me-1" aria-hidden="true"></i>
<span>Load in Cart</span>
</a>
</t>
</xpath>
</template> -->
<!-- Custom portal content template with group order info -->
<template id="sale_order_portal_content_aplicoop" inherit_id="sale.sale_order_portal_content" name="Sale Order Portal Content - Aplicoop">
<!-- Insert group order info BEFORE the products table -->
<xpath expr="//table[@id='sales_order_table']" position="before">
<t t-if="sale_order.group_order_id">
<div class="row mb-4">
<!-- Group Order Info -->
<div class="col-lg-12">
<div class="card">
<!-- text-bg-primary, not bg-primary: a badge's default white on
the primary blue is 3.98:1, under AA. The utility picks a
contrasting foreground for whatever the theme colour is.
d-block on the notes so their mt-2 actually applies — margins
do nothing on an inline span. -->
<div class="card-header bg-light">
<strong><t t-esc="sale_order.group_order_id.name"/></strong>
<t t-if="sale_order.home_delivery">
<span class="badge text-bg-primary">
<t t-set="day_idx" t-value="(int(sale_order.group_order_id.pickup_day) + 1) % 7 if sale_order.group_order_id.pickup_day else 0"/>
<t t-esc="day_names[day_idx] if day_names else ''"/>,
<t t-esc="sale_order.group_order_id.delivery_date.strftime('%d/%m/%Y') if sale_order.group_order_id.delivery_date else ''"/>
</span>
<span class="d-block mt-2 text-muted small">
<t t-esc="sale_order.group_order_id.delivery_notice"/>
</span>
</t>
<t t-else="">
<span class="badge text-bg-primary">
<t t-set="day_idx" t-value="int(sale_order.group_order_id.pickup_day) % 7 if sale_order.group_order_id.pickup_day else 0"/>
<t t-esc="day_names[day_idx] if day_names else ''"/>,
<t t-esc="sale_order.pickup_date.strftime('%d/%m/%Y')"/>
</span>
<span class="d-block mt-2 small">
<t t-foreach="sale_order.group_order_id.group_ids" t-as="group">
<t t-esc="group.name"/>
<t t-if="group.street">
<t t-esc="group.street"/>
</t>
<t t-if="group.city">
<t t-esc="group.zip"/> <t t-esc="group.city"/>
</t>
</t>
</span>
</t>
</div>
</div>
</div>
</div>
</t>
</xpath>
</template>
</data>
</odoo>