Commit graph

271 commits

Author SHA1 Message Date
snt
aef57a3de4 [DOC] product_sale_price_from_pricelist: actualizar documentación v18.0.2.7.0
- CHANGELOG: documentar nueva funcionalidad de actualización de órdenes de venta
- README: añadir sección sobre Update Sales Orders from List Price
- README_DEV: incluir uso de la acción en workflow
- readme/USAGE: detallar paso a paso para actualizar órdenes

Funcionalidad documentada:
- Botón/acción para actualizar líneas de orden de venta con precio actual del producto
- Solo procesa órdenes no facturadas/canceladas
- Preserva descuentos, omite notas/secciones y anticipos
- Disponible en vista formulario y lista
2026-02-27 17:10:53 +01:00
snt
d294843241 [DOC] stock_picking_batch_custom: documentación OCA 2026-02-27 17:09:22 +01:00
snt
55497327e8 [ADD] product_sale_price_from_pricelist: update sale orders from list price 2026-02-27 17:05:54 +01:00
snt
ced21cc489 [ADD] stock_picking_batch_custom: columnas opcionales partner y categoría 2026-02-27 16:03:25 +01:00
snt
97dc41d212 [FIX] website_sale_aplicoop: toggle reparto desde carrito 2026-02-27 15:43:59 +01:00
snt
2f57a5d14e [IMP] group_order: confirmar sale orders en cron diario 2026-02-27 15:19:41 +01:00
snt
6935d8fc83 [FIX] website_sale_aplicoop: save draft on checkout button 2026-02-27 14:58:20 +01:00
snt
6f593c6240 [ADD] product_main_seller: Restore OCA addon from original version
- Restored product_main_seller addon to fix dependency chain
- Addon required by product_origin_char and website_sale_aplicoop

[IMP] website_sale_aplicoop: Add demo data configuration to manifest

- Updated __manifest__.py to include demo data files
- Demo data includes partners, suppliers, products, group orders, and sale orders
- Demo data successfully loads during module installation
2026-02-27 14:07:41 +01:00
snt
a483925005 demo files 2026-02-27 13:43:56 +01:00
snt
6381a2d985 cleaned OCA addon 2026-02-27 13:42:41 +01:00
snt
d58c621ef1 [FIX] website_sale_aplicoop: enable add to cart 2026-02-27 13:30:00 +01:00
snt
130a5ff6c4 [FIX] website_sale_aplicoop: Arreglar botón Home Delivery en shop (añadir/remover producto de entrega al carrito) 2026-02-26 15:12:06 +01:00
snt
4a668b3240 [REF] website_sale_aplicoop: Mejorar legibilidad del XML (reformatear con mejor indentación) 2026-02-26 14:59:34 +01:00
snt
67215f7684 [FIX] website_sale_aplicoop: Remover _() de template QWeb (no funciona en contexto QWeb) 2026-02-26 14:45:35 +01:00
snt
9937e987f4 [I18N] website_sale_aplicoop: Limpieza de traducciones y etiquetas UI en inglés por defecto 2026-02-26 14:33:44 +01:00
snt
c2f9f347b7 chore: eliminar módulo obsoleto product_origin
Eliminado product_origin (antiguo) que ha sido reemplazado por product_origin_char.
El nuevo módulo product_origin_char usa tipo Char en vez de Selection para el campo origin.
2026-02-25 20:19:05 +01:00
snt
2a005a9d5a feat(website_sale_aplicoop): sistema de ribbons basado en stock
- Añadidos ribbons 'Sin Stock' (rojo) y 'Pocas Existencias' (amarillo)
- Nuevo campo configurable: umbral de stock bajo (default: 5.0)
- Campos computed en product.product:
  * is_out_of_stock: True cuando qty_available <= 0
  * is_low_stock: True cuando 0 < qty_available <= threshold
  * dynamic_ribbon_id: ribbon automático según nivel de stock
- Ordenamiento mejorado: productos con stock primero, sin stock al final
- Template actualizado:
  * Muestra ribbon de stock en tarjeta de producto
  * Deshabilita botón add-to-cart cuando producto sin stock
  * Cambia icono a 'fa-ban' en productos sin stock
- Vista de configuración: campo 'Low Stock Threshold' en Settings > Shop Performance
- Solo aplica a productos type='consu' (almacenables)
- Tests: 112 pasados, 0 fallos
2026-02-25 19:48:39 +01:00
snt
539cd5cccd feat(website_sale_aplicoop): ordenar productos por website_sequence y nombre
- Ordena productos primero por website_sequence y luego alfabéticamente por nombre (case-insensitive)
- Fix test: cambiar tipo de producto de 'product' a 'consu' (Odoo 18 compatibility)
2026-02-25 19:34:49 +01:00
snt
3f822a28cf [FIX] mypy: Configure to ignore missing Odoo imports globally
- Set ignore_missing_imports = True at global [mypy] level
- Add explicit sections for odoo, odoo.*, and odoo.addons.*
- Fixes pre-commit hook failures when mypy checks Odoo addon files
- Resolves 'Cannot find implementation or library stub for module named odoo' errors

This is a known issue with Odoo stubs not being fully compatible with mypy.
2026-02-25 19:01:28 +01:00
snt
1779c42e9b [IMP] website_sale_aplicoop: Replace product_origin with product_origin_char
- Replace dependency from product_origin to product_origin_char
- Update product card template to show origin_text field instead of country_id/state_id
- Simpler and more flexible: free text origin per supplier instead of structured fields
- Version: 18.0.1.6.0 -> 18.0.1.7.0

The new field is more suitable for creative product origins like 'Valencia, Huerta de...'
or 'Región de Murcia, cooperativa XX' which don't fit the rigid country/state structure.
2026-02-25 18:55:33 +01:00
snt
e4e03d4794 tmp/ 2026-02-25 18:43:46 +01:00
snt
c8b83cc333 [ADD] product_origin_char: Free text origin field per supplier
New addon to replace structured country/state fields with flexible
free-text origin descriptions.

Features:
- Translatable origin_text field in product.supplierinfo
- Computed origin field in products based on main_seller_id
- Support for creative supplier origin descriptions
- Full OCA documentation structure
- ES/EU translations included
- 8 unit tests (all passing)

Replaces product_origin for use cases where suppliers use non-standardized
origin descriptions (e.g., 'Valencia, Spain', 'Huerta de...', etc.)

Depends on: product, product_main_seller
Author: Criptomart
Funding: Elika Bilbo
2026-02-25 18:42:54 +01:00
snt
1a8f92a01e iconos 2026-02-25 18:41:16 +01:00
snt
c367e20fc5 [DOC] Limpiar documentación temporal y scripts de test obsoletos 2026-02-25 17:47:33 +01:00
snt
464ca48127 [IMP] website_sale_aplicoop: quantity_step multilingüe usando XML IDs de UoM. Detecta peso, volumen, longitud, superficie independiente del idioma. 2026-02-25 17:45:45 +01:00
snt
92b35ccd6d [FIX] website_sale_aplicoop: step de cantidad correcto tras filtrar categoría. El JS ahora usa data-quantity-step generado por backend, evitando sobrescribir el step correcto en inputs de productos a peso/unidad. 2026-02-25 17:17:06 +01:00
snt
7b343ef198 [FIX] website_sale_aplicoop: Fix category filter ignoring blacklists
Critical fix for category filter in product discovery:

- BREAKING BUG: Category filter was doing a new search() that
  completely ignored product/supplier/category blacklists
- FIX: Now filters from filtered_products (which has blacklists applied)
  instead of doing a fresh search() from database
- This ensures blacklist rules are ALWAYS respected

Added detailed logging for debugging empty category results:
- Log collected category IDs (including children)
- Log before/after product counts
- If result is empty, log sample product categories to help debug
- Helps identify configuration issues vs code bugs

This fixes user report: 'no muestra ningún producto' in some categories
The issue was that filtered products were being replaced with a fresh
search that bypassed all blacklist filters.
2026-02-23 16:09:29 +01:00
snt
c1226e720b [ADD] website_sale_aplicoop: Category blacklist with recursive exclusion
- Add comprehensive test suite for excluded_category_ids
- 9 tests covering: single category, recursive subcategories,
  parent exclusion, direct product override, unrelated categories,
  empty blacklist, multiple exclusions, combined blacklists,
  available_products_count validation
- Update UI to show excluded_category_ids in 'Productos Excluidos'
- Bump version to 18.0.1.6.0
- Update CHANGELOG with category blacklist documentation

Technical notes:
- Category blacklist was already implemented in model/logic
- This commit adds missing tests and documentation
- Recursive exclusion via get_all_excluded_descendants()
- Blacklist has absolute priority over all inclusion sources
2026-02-22 23:04:33 +01:00
snt
d90f2cdc61 [ADD] website_sale_aplicoop: Supplier blacklist feature for group orders
- Add excluded_supplier_ids field for supplier exclusion
- Filter products by main_seller_id (from product_main_seller addon)
- Blacklist has absolute priority over all inclusion sources
- Products with blacklisted main supplier never appear in orders
- Update _get_products_for_group_order() with supplier blacklist logic
- Add excluded_supplier_ids to 'Productos Excluidos' section in form view
- Add comprehensive test suite (TestSupplierBlacklist class with 9 tests):
  * Test exclusion by main_seller_id
  * Test multiple supplier exclusion
  * Test products without main seller not affected
  * Test blacklist with direct product inclusion
  * Test blacklist priority over supplier inclusion
  * Test combined product and supplier blacklist
  * Test available_products_count with supplier blacklist
- Add Spanish and Euskera translations
- Update available_products_count computation to include excluded_supplier_ids
- Version bump to 18.0.1.5.0

Use case: Exclude all products from specific supplier (e.g., temporary unavailability)
Example: Category with 100 products, exclude supplier X → all products from X excluded
Workflow: Bulk inclusion via categories + supplier-level exclusion + product-level exclusion
2026-02-22 21:35:40 +01:00
snt
75ebb7b907 [ADD] website_sale_aplicoop: Product blacklist feature for group orders
- Add excluded_product_ids field for explicit product exclusion
- Blacklist has absolute priority over all inclusion sources (product_ids, category_ids, supplier_ids)
- Update _get_products_for_group_order() with blacklist filter logic
- Rename 'Associations' section to 'Catálogo de Productos' with subsections:
  * Productos Incluidos (whitelist: suppliers, categories, direct products)
  * Productos Excluidos (blacklist: explicit exclusions)
- Add comprehensive test suite (TestProductBlacklist class with 7 tests)
- Add Spanish and Euskera translations
- Update available_products_count computation to include excluded_product_ids
- Version bump to 18.0.1.4.0

Use case: Bulk inclusion via categories/suppliers + fine-grained exclusion via blacklist
Example: Select a category with 100 products, exclude 5 unwanted → 95 available
2026-02-22 20:41:11 +01:00
snt
4a4639f13a [DOC] Actualizar documentación a estándares OCA y preparar logo CriptoMart
- Renombrar README.md a README_DEV.md en todos los addons custom
- Crear README.rst siguiendo estructura OCA oficial
- Crear directorios readme/ con fragmentos .rst (DESCRIPTION, INSTALL, CONFIGURE, USAGE, CONTRIBUTORS, CREDITS)
- Actualizar créditos: Criptomart (autor) + Elika Bilbo (financiador)
- Actualizar __manifest__.py con maintainers correctos
- Crear estructura static/description/ para logo en 5 addons
- Agregar documentación de logo (LOGO_INSTRUCTIONS.md, install_logo.sh)
- Actualizar copilot-instructions.md con referencias a OCA_DOCUMENTATION.md
- Crear docs/OCA_DOCUMENTATION.md con guía completa de estructura
- Crear docs/RESUMEN_CAMBIOS_DOCUMENTACION.md con resumen detallado

Addons actualizados:
- website_sale_aplicoop
- product_sale_price_from_pricelist
- product_pricelist_total_margin
- product_price_category_supplier
- account_invoice_triple_discount_readonly
2026-02-21 19:55:57 +01:00
snt
b31df7b9d8 [DOC] product_pricelist_total_margin: Update docs and version to 18.0.1.2.0
Changelog:
- Document global_margin_type feature for independent global limits calculation
- Update version from 18.0.1.1.0 to 18.0.1.2.0
- Update test coverage count (11 → 13 tests)
- Update manifest summary to include global limits enforcement
2026-02-21 19:19:25 +01:00
snt
449bb75bb6 [IMP] product_pricelist_total_margin: Add global_margin_type for min/max limits
- Add global_margin_type field in res.config.settings
  * Options: 'markup' (default) or 'margin' (commercial margin)
  * Determines how global min/max percentages are interpreted
- Refactor _apply_global_margin_limits():
  * Now receives price instead of margin percentage
  * Calculates min/max prices based on global_margin_type
  * Returns adjusted price instead of adjusted margin
  * Supports both markup and commercial margin formulas
- Update _compute_price() to apply limits after price calculation
- Update res_config_settings_views.xml to show global_margin_type selector
- Update help texts with examples for both calculation methods
- Add 2 new tests to validate global limits with commercial margin type:
  * test_global_minimum_with_commercial_margin_type
  * test_global_maximum_with_commercial_margin_type
- All 13 tests passing (11 existing + 2 new)

Example with global min 25%:
- Markup: Min price = Cost × 1.25
- Commercial Margin: Min price = Cost / 0.75 (ensures 25% margin on PVP)
2026-02-21 19:16:16 +01:00
snt
07cc0eb517 [DOC] product_pricelist_total_margin: Update documentation for v1.1.0
- Update README with margin_type field documentation
- Add detailed explanations for both calculation methods:
  * Markup (on cost): PVP = Cost × (1 + markup%)
  * Commercial Margin (on PVP): PVP = Cost / (1 - margin%)
- Add examples comparing both methods
- Update features list with new capabilities
- Update configuration steps to include margin_type selector
- Update technical details with new field specifications
- Update test coverage section (11 tests)
- Add logging examples for both methods
- Update changelog with v18.0.1.1.0 release notes
- Bump version to 18.0.1.1.0 in __manifest__.py
- Update summary to reflect new features
2026-02-21 19:11:01 +01:00
snt
55406ca22d [FIX] product_pricelist_total_margin: Change field string to avoid redundancy
- Change margin_type string from 'Margin Type' to 'Calculation Method'
- Fixes pylint warning W8113 (attribute-string-redundant)
2026-02-21 18:55:00 +01:00
snt
0f239601ce [IMP] product_pricelist_total_margin: Add margin_type selector (Markup vs Commercial Margin)
- Add margin_type field to choose between calculation methods:
  * Markup (on cost): PVP = Cost × (1 + markup%)
  * Commercial Margin (on PVP): PVP = Cost / (1 - margin%)
- Update _compute_price() to apply correct formula based on margin_type
- Add safety cap for commercial margin >= 100% (caps at 99%)
- Add detailed logging for both calculation types
- Update views to show margin_type field when use_total_margin is enabled
- Add 2 new tests to validate both calculation methods:
  * test_total_margin_markup_type: validates markup formula
  * test_total_margin_commercial_margin_type: validates commercial margin formula
- All 11 tests passing (9 existing + 2 new)

Example with Commercial Margin:
Base: 4.68€, Total Margin: 20%
- Markup: 4.68 × 1.20 = 5.616€ (margin = 16.67% of PVP)
- Commercial Margin: 4.68 / 0.80 = 5.85€ (margin = 20% of PVP) ✓
2026-02-21 18:54:38 +01:00
snt
cafa19ffea [ADD] website_sale_aplicoop: Add sequence field to group.order for custom ordering
- Add sequence field to group.order model with default value 10
- Update _order to sort by sequence first, then start_date desc
- Add sequence field to tree view with handle widget for drag-and-drop reordering
- Add sequence field to form view for manual editing
- Orders in website list will now be ordered by sequence field
2026-02-21 16:37:55 +01:00
snt
32f345bc44 [ADD] product_pricelist_total_margin: New module for additive margin calculation
- Add use_total_margin field to pricelist items
- Override _compute_price() to sum margins additively instead of compounding
- Support chained pricelists with custom base types (last_purchase_price)
- Add global minimum and maximum margin limits configuration
- Store limits in ir.config_parameter via res.config.settings
- Apply global limits after total margin calculation
- Add comprehensive test suite (9 tests) covering:
  * Basic additive vs compound margin behavior
  * Three-level pricelist chains
  * Global minimum/maximum margin enforcement
  * Rounding and surcharge compatibility
- Add configuration UI in Settings > Sales
- All tests passing (9/9)

This module fixes the issue where chained pricelists were compounding margins
instead of calculating total margins. Example: base 4.68€ with -5% and +25%
now correctly results in 5.616€ (20% total) instead of 5.56€ (compound).
2026-02-21 16:11:13 +01:00
snt
f35bf0c5a1 [FIX] website_sale_aplicoop: Calculate UoM quantity step server-side for portal users
Portal users cannot read uom.uom model due to ACL restrictions (1,0,0,0 permissions).
This caused products sold by weight (kg) to have incorrect quantity step (1 instead of 0.1).

Solution:
- Calculate quantity_step in Python controller using product.uom_id.sudo()
- Check if UoM category contains 'weight' or 'kg' -> use step=0.1
- For other products, use default step=1
- Pass quantity_step to template via product_display_info dict
- Update XML input attributes (value, min, step) to use dynamic quantity_step

This maintains proper UX for bulk products while respecting security permissions.
2026-02-21 14:31:34 +01:00
snt
ed8c6acd92 [FIX] website_sale_aplicoop: Add portal user support for sale.order creation
Portal users don't have write/create permissions on sale.order by default.
This causes errors when trying to create orders during checkout or draft save.

Changes:
- Add _get_salesperson_for_order() helper to retrieve partner's salesperson
- Use sudo() for all sale.order create() operations
- Automatically assign user_id (salesperson) when creating orders
- Use sudo() for order updates and line modifications
- Add fallback to commercial_partner_id.user_id for salesperson

This ensures orders are created with proper permissions while maintaining
traceability through the assigned salesperson.

Test coverage:
- Add test_portal_sale_order_creation.py with 3 tests
- Test portal user creates sale.order
- Test salesperson fallback logic
- Test portal user updates order lines
2026-02-21 14:09:57 +01:00
snt
cf9ea887c1 [REF] Code quality improvements and structure fixes
- Add mypy.ini configuration to exclude migration scripts
- Rename migration files to proper snake_case (post-migration.py → post_migration.py)
- Add __init__.py to migration directories for proper Python package structure
- Add new portal access tests for website_sale_aplicoop
- Code formatting improvements (black, isort)
- Update copilot instructions and project configuration

Related to previous code quality refactoring work.
2026-02-21 13:51:25 +01:00
snt
380d05785f [FIX] Fix docutils warnings in product_price_category_supplier README
- Replace code-block directives with simple :: blocks (no Pygments required)
- Fix duplicate implicit target name for res.partner sections
- Ensure README parses correctly without warnings during module load

This resolves the docutils system warnings that appeared during module upgrade.
2026-02-21 13:37:44 +01:00
snt
0a2cc4c8c4 [FIX] Code quality refactoring: remove F401, fix translations, improve test coverage
- Remove unused imports (F401) across multiple addons (__init__.py files)
- Fix W8161 (prefer-env-translation): replace global _() with self.env._() and request.env._()
- Fix W8301 (translation-not-lazy): use named placeholders instead of % formatting
  - group_order.py: Fix 2 constraint messages
  - wizard_update_product_category.py: Fix notification message
- Fix E722 (bare except): add proper Exception handling with logging in website_sale.py
- Fix W8116/E8102 (post-migrate.py): remove cr.commit() and print(), add logging
- Fix W8150 (relative imports): update test_templates_rendering.py imports
- Fix F841 (assigned but unused): Remove unused variable assignments in tests
- Add mypy.ini with exclude pattern for migrations to avoid duplicate module errors
- Add __init__.py files in migration directories for proper Python package structure
- Restore migration scripts (post-migration.py) that were deleted
- Update pyproject.toml with mypy configuration
- Replace print() with logging in test_prices.py
- Fix CSS indentation in header.css
- Add portal access tests to improve test coverage

This refactoring improves:
- Code quality: All F401, E722, W8161, W8301, W8150, E8102/W8116 violations resolved
- Internationalization: Proper use of env._() with lazy formatting
- Testing: Reduced unused variable assignments and improved portal user testing
- Linting: All pre-commit hooks passing (except non-critical B018, C8116, W8113)
2026-02-21 02:13:40 +01:00
snt
b8f55135d9 website_sale_aplicoop: use sudo() when reading ir.config_parameter in controllers 2026-02-20 20:52:29 +01:00
snt
a1431d3521 website_sale_aplicoop: añadir settings, incluir data/groups.xml en manifest y limpiar vistas duplicadas 2026-02-20 20:44:58 +01:00
snt
02a4758635 [DOC] Añadir archivos de skills detallados (python, xml, html_css, javascript) y actualizar README.md con instrucciones de tests actualizadas. 2026-02-20 20:34:49 +01:00
snt
625b9582b3 [DOC] Añadir sección AI Agent Skills & Prompt Guidance al inicio de copilot-instructions.md para centralizar mejores prácticas y skills detallados. 2026-02-20 20:29:43 +01:00
snt
5d4552581c [IMP] website_sale_aplicoop: Auto-carga de productos al filtrar por tags
Mejora en la UX del filtrado por tags:
- Cuando se aplica un filtro que deja pocos productos visibles (<10),
  automáticamente carga más páginas sin esperar scroll del usuario
- Evita pantallas vacías o con muy pocos productos después de filtrar
- El auto-carga se ejecuta con delay de 100ms para evitar race conditions
- Solo se activa si hay más páginas disponibles (hasMore) y no está ya cargando

Nuevo método: _autoLoadMoreIfNeeded(visibleCount)
- Umbral configurable: 10 productos mínimos
- Se llama automáticamente desde _filterProducts()
- Integración con infiniteScroll.loadNextPage()
2026-02-18 19:01:33 +01:00
snt
19eb1b91b5 [FIX] website_sale_aplicoop: Arreglar búsqueda y filtrado por tags
Problemas resueltos:
- Contador de badges mostraba solo productos de página actual (20) en lugar del total
- Productos cargados con lazy loading no se filtraban por tags seleccionados

Cambios en realtime_search.js:
- Eliminado recálculo dinámico de contadores en _filterProducts()
- Los contadores permanecen estáticos (calculados por backend sobre dataset completo)
- Mejorado logging para debug de tags seleccionados

Cambios en infinite_scroll.js:
- Después de cargar nueva página, actualiza lista de productos para realtime search
- Aplica filtros activos automáticamente a productos recién cargados
- Garantiza consistencia de estado de filtrado en toda la aplicación

Documentación:
- Añadido docs/TAG_FILTER_FIX.md con explicación completa del sistema
- Incluye arquitectura, flujo de datos y casos de prueba
2026-02-18 18:51:26 +01:00
snt
fee8ec9c45 [DOC] Actualizar documentación y instrucciones con cambios recientes (v18.0.1.3.1)
- [FIX] Actualizar copilot-instructions.md con nuevas secciones:
  * QWeb Template Best Practices (patrón crítico para templates complejos)
  * Eskaera System mejorado con info de lazy loading v18.0.1.3.0+
  * QWeb Template Errors en Common Issues & Solutions
  * Recent Changes Summary (actualizado a 2026-02-18)

- [ADD] Nuevo documento docs/RECENT_CHANGES.md:
  * Timeline completo de cambios (Feb 2-18, 2026)
  * 4 secciones principales de cambios documentados
  * Impacto y acciones requeridas por developers
  * Referencias cruzadas a documentación técnica

- [UPD] README.md principal:
  * website_sale_aplicoop actualizado a v18.0.1.3.1
  * Mención de fixes críticos de v18.0.1.3.1
  * Referencias a FINAL_SOLUTION_SUMMARY.md

- [REF] product_main_seller/README.md:
  * Removidas referencias obsoletas a default_supplier_id
  * Documentación actualizada para usar main_seller_id
  * Simplificada sección de Computation Logic

- [UPD] docs/README.md:
  * Nueva sección "Cambios Recientes"
  * Reorganizado índice de documentación de template fixes
  * Mejorada estructura de secciones de troubleshooting

Cambios Documentados:
 Refactoring product_main_seller (18 Feb) - Removido campo alias
 v18.0.1.3.1 Fixes (16 Feb) - Date calculations y template rendering
 v18.0.1.3.0 Lazy Loading (12 Feb) - Performance improvement 95%
 Template Logic Refactoring (Feb 2-16) - QWeb best practices

+438 líneas de documentación nueva/actualizada
2026-02-18 18:37:43 +01:00