[IMP] website_sale_aplicoop: Validar disponibilidad de productos al cargar órdenes históricas
- Backend: Agregar método _validate_items_for_group_order() para validar que los productos históricos sigan siendo disponibles en la orden de grupo actual - Backend: Modificar load_order_from_history() para filtrar solo items disponibles antes de pasar al template - Backend: Generar mensaje de aviso traducido cuando hay productos no disponibles - Template: Pasar información de productos no disponibles y warnings al JavaScript - Frontend: Mostrar notificación de advertencia si hubo productos excluidos durante la carga histórica - Notas: Esto evita cargar productos que ya no existen en la orden actual debido a cambios en categorías, proveedores o listas negras
This commit is contained in:
parent
4a928e92dd
commit
3ca90578ae
7 changed files with 271 additions and 8 deletions
|
|
@ -19,12 +19,17 @@
|
|||
var homeDelivery = <t t-esc="home_delivery and 'true' or 'false'"/>;
|
||||
var sameGroupOrder = <t t-esc="same_group_order and 'true' or 'false'"/>;
|
||||
|
||||
// Product availability warning
|
||||
var hasUnavailableItems = <t t-esc="has_unavailable_items and 'true' or 'false'"/>;
|
||||
var warningMessage = '<t t-esc="warning_message or ''"/>';
|
||||
|
||||
console.log('load_from_history template: groupOrderId=', groupOrderId);
|
||||
console.log('load_from_history template: saleOrderName=', saleOrderName);
|
||||
console.log('load_from_history template: pickupDay=', pickupDay);
|
||||
console.log('load_from_history template: pickupDate=', pickupDate);
|
||||
console.log('load_from_history template: homeDelivery=', homeDelivery);
|
||||
console.log('load_from_history template: sameGroupOrder=', sameGroupOrder);
|
||||
console.log('load_from_history template: hasUnavailableItems=', hasUnavailableItems);
|
||||
console.log('load_from_history template: itemsJson type=', typeof itemsJson);
|
||||
console.log('load_from_history template: itemsJson value=', itemsJson);
|
||||
|
||||
|
|
@ -47,6 +52,12 @@
|
|||
console.log('Skipped saving pickup fields (different group order - will use current group order days)');
|
||||
}
|
||||
|
||||
// Store warning about unavailable products if they exist
|
||||
if (hasUnavailableItems === 'true') {
|
||||
sessionStorage['load_from_history_warning_' + groupOrderId] = warningMessage;
|
||||
console.log('Unavailable products detected:', warningMessage);
|
||||
}
|
||||
|
||||
console.log('Saved to sessionStorage[load_from_history_' + groupOrderId + ']:', itemsJsonString);
|
||||
console.log('Saved order name to sessionStorage[load_from_history_order_name_' + groupOrderId + ']:', saleOrderName);
|
||||
|
||||
|
|
|
|||
37
website_sale_aplicoop/views/website_sale_disable_cart.xml
Normal file
37
website_sale_aplicoop/views/website_sale_disable_cart.xml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- ==========================================
|
||||
DISABLE STANDARD WEBSITE_SALE CART
|
||||
Convert /shop to a simple product catalog
|
||||
========================================== -->
|
||||
|
||||
<!-- Hide the cart link from the header -->
|
||||
<template id="header_cart_link_hidden" inherit_id="website_sale.header_cart_link" name="Hide Cart Link">
|
||||
<xpath expr="//li[hasclass('o_wsale_my_cart')]" position="attributes">
|
||||
<attribute name="class" add="d-none" separator=" "/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Remove "Add to Cart" button from product items in the shop -->
|
||||
<template id="products_item_no_add_to_cart" inherit_id="website_sale.products_item" name="Product Item Without Add to Cart">
|
||||
<!-- Remove the form action that points to /shop/cart/update -->
|
||||
<xpath expr="//form[hasclass('oe_product_cart')]" position="attributes">
|
||||
<attribute name="action">/</attribute>
|
||||
<attribute name="method">get</attribute>
|
||||
</xpath>
|
||||
<!-- Hide the quick add button area completely -->
|
||||
<xpath expr="//div[hasclass('o_wsale_product_btn')]" position="attributes">
|
||||
<attribute name="class" add="d-none" separator=" "/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Hide cart suggestion snippets and related cart features -->
|
||||
<template id="suggested_products_list_hidden" inherit_id="website_sale.suggested_products_list" name="Hide Suggested Products" active="False">
|
||||
<xpath expr="//*[hasclass('js_cart_lines')]" position="attributes">
|
||||
<attribute name="class" add="d-none" separator=" "/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue