Implementa test_phase3_confirm_eskaera.py con cobertura completa de los 3 helpers
creados en Phase 3 del refactoring de confirm_eskaera():
Helper Methods Tested:
- _validate_confirm_json(): Validación de request JSON
- _process_cart_items(): Procesamiento de items del carrito
- _build_confirmation_message(): Construcción de mensajes localizados
Test Coverage:
- 4 test classes
- 24 test methods
- 61 assertions
Test Breakdown:
1. TestValidateConfirmJson (5 tests):
- Validación exitosa de datos JSON
- Manejo de error: order_id faltante
- Manejo de error: order no existe
- Manejo de error: carrito vacío
- Validación de flag is_delivery
2. TestProcessCartItems (5 tests):
- Procesamiento exitoso de items
- Fallback a list_price cuando price=0
- Skip de productos inválidos
- Error cuando no quedan items válidos
- Traducción de nombres de productos
3. TestBuildConfirmationMessage (11 tests):
- Mensaje de confirmación para pickup
- Mensaje de confirmación para delivery
- Manejo cuando no hay fechas
- Formato de fecha DD/MM/YYYY
- Soporte multi-idioma: ES, EU, CA, GL, PT, FR, IT
4. TestConfirmEskaera_Integration (3 tests):
- Flujo completo para pickup order
- Flujo completo para delivery order
- Actualización de draft existente
Features Validated:
✅ Validación robusta de request JSON con mensajes de error claros
✅ Procesamiento de items con manejo de errores y fallbacks
✅ Construcción de mensajes con soporte para 7 idiomas
✅ Diferenciación pickup vs delivery con fechas correctas
✅ Integración completa end-to-end del flujo confirm_eskaera
Quality Checks:
✅ Sintaxis Python válida
✅ Pre-commit hooks: black, isort, flake8, pylint (all passed)
✅ 671 líneas de código de tests
✅ 29 docstrings explicativos
Total Test Suite (Phase 1 + 2 + 3):
- 53 test methods (18 + 11 + 24)
- 3 test files (test_helper_methods_phase1.py, test_phase2_eskaera_shop.py, test_phase3_confirm_eskaera.py)
- 1,311 líneas de código de tests
Este commit completa la implementación de tests para el refactoring completo de 3 fases,
proporcionando cobertura exhaustiva de todas las funcionalidades críticas del sistema
eskaera (pedidos de grupo cooperativos).
Files:
- website_sale_aplicoop/tests/test_phase3_confirm_eskaera.py (NEW, 671 lines)
- Changed parameter from 'qty' to 'quantity' to match Odoo 18.0 base class
- Fixes TypeError: ProductPricelistItem._compute_price() got an unexpected keyword argument 'quantity'
- This was causing price calculation failures when saving sale orders
[FIX] website_sale_aplicoop: Fix logging format string
- Changed logging format from %d to %s for existing_draft_id which is a string from JSON
- Fixes 'TypeError: %d format: a real number is required, not str' in logging
- Changed parent_id from website.menu_homepage to website.main_menu (correct menu hierarchy)
- Added type='int' to sequence field for consistency with Odoo standards
- Fixes ParseError when loading website_menus.xml
- Created data/website_menus.xml with website menu item pointing to /eskaera
- Added website_menus.xml to manifest data files
- Menu appears in website navigation with sequence 50
Fixed error: TypeError: float() argument must be a string or a real
number, not 'dict' when entering decimal values in product form.
Added post-migration to delete ir_property records left over from when
fields were company_dependent. These leftover records were causing dict
values to be passed to Float fields during onchange operations.
Migration checks if ir_property table exists to handle fresh installs
gracefully.
Version bump: 18.0.2.3.0 -> 18.0.2.4.0
Fixed error: column 'last_purchase_price_compute_type' is of type jsonb
but expression is of type character varying.
Removed company_dependent=True from all fields in product.product:
- last_purchase_price_updated
- list_price_theoritical
- last_purchase_price_received
- last_purchase_price_compute_type
Fields are now stored directly in product_product table instead of
ir_property, which fixes save errors and simplifies data storage.
Version bump: 18.0.2.2.0 -> 18.0.2.3.0
Fixed TypeError: value.toFixed is not a function when rendering monetary
fields in product form views. Added default=0.0 to list_price_theoritical
and last_purchase_price_received fields to prevent JavaScript from trying
to format False values as numbers.
Version bump: 18.0.2.1.0 -> 18.0.2.2.0
- Move migration from pre-migrate.py to post-migrate.py
- pre-migrate runs before ORM creates columns, causing 'column does not exist' errors
- post-migrate runs after columns are created, safe for updates
- Add check for column existence to handle fresh installations gracefully
- Ensures migration only runs when upgrading from older versions with data
Migration (18.0.2.1.0):
- Migrate price fields from product.template to product.product
- Fields were previously stored in template during initial refactoring
- Data now properly located in product variant storage
Changes:
- Add migration pre-migrate.py to handle data migration automatically
- Add test_theoretical_price.py with comprehensive diagnostic tests
- Add test_full_flow_updates_theoretical_price to verify complete workflow
- Enhance stock_move.py with additional debug logging to diagnose issues
- Update __manifest__.py version to 18.0.2.1.0
- Update tests/__init__.py to include new test module
Fixes:
- last_purchase_price_received was stored in product.template but read from product.product
- Causes theoretical price calculation to show 0.0 instead of correct value
- Migration script copies data to correct model with company_dependent JSON format
Use write() instead of direct assignment to ensure last_purchase_price_received
is persisted before computing theoretical price. The with_company() creates a
new recordset and direct assignment may not propagate correctly.
- Write field values to product.product variants directly in tests
- Call price_compute on variant (product.product) not template
- Adjust expected prices to NOT include tax (calculated on sales)
- Clear taxes explicitly in no-tax test to avoid inheritance
- Fix floating point precision issue in rounding test
- Add taxes and skip logic to UoM conversion test
- All 32 tests now pass
- Cambiar parámetro qty= a quantity= en llamadas a _compute_price_rule
- Eliminar type/detailed_type de product.product creates
- Añadir campo name a purchase.order.line
- Agregar método _compute_theoritical_price en template
- Crear helpers para leer precios teóricos desde variante
- Corregir variables no usadas y nombres indefinidos
Instead of converting templates to variants before calling super(), check
the model type when processing results. If working with product.template,
get the variant from the template using browse(). This preserves the
expected ID mapping in the result dictionary and avoids lambda variable
binding issues.
Fixes: KeyError: 9 in pricelist computation
Added check to ensure _compute_price_rule always works with product.product.
When product.template records are passed, convert them to their variants
before processing. This prevents MissingError when browsing product.product
with template IDs.
Fixes: Record does not exist or has been deleted (Record: product.product(22,))
Added last_purchase_price computed field in product.template as an alias
to last_purchase_price_received. This field is required for compatibility
with Odoo's standard pricelist system which accesses template['last_purchase_price']
during price computation.
Fixes KeyError: 'last_purchase_price' in website shop controller.
- Moved all main fields from product.template to product.product
- Created computed fields in product.template with inverse/search methods
- Moved business logic (_compute_theoritical_price, action_update_list_price) to product.product
- Updated stock_move.py to work directly with product.product
- Fixed searchable field warnings by using compute/inverse/search pattern
- Fixed linting issues: removed unused imports, added return statement, use self.env._() with named placeholders
- Added migration script and CHANGELOG
- Version bumped to 18.0.2.0.0
This fixes pricelist report generation issues and follows Odoo best practices
for product variant handling.
- Add product_origin dependency to show country/state of origin
- Display country_id and state_id fields in product cards with map marker icon
- Show only populated fields (conditional rendering)
- Fields appear after supplier info in eskaera shop template
- Country names auto-translate based on user language (state names do not)
- Format: 'State, Country' or just 'Country' if no state
- Create .github/copilot-instructions.md with global development guidelines
- Add comprehensive README.md at project root with quick start guide
- Create docs/ directory for technical documentation
- Move installation and linter docs to docs/
- Add docs/TRANSLATIONS.md with complete translation system guide
- Create README.md for OCA modified addons (product_origin, product_get_price_helper, product_main_seller)
- Document translation best practices (no _() in field definitions)
- Add references between all documentation files
- Clean up project root by moving technical docs to docs/
All documentation now properly references addon-specific READMEs for detailed architecture and implementation.
- Add action_update_list_price button in form and list views
- Button shows only when compute type is not manual_update
- Return notification message with update results
- Invalidate cache to refresh UI automatically
- Show updated products with old and new prices
- Display skipped products with manual update mode
El método _get_price() del addon OCA ya maneja correctamente los impuestos
según la configuración de Odoo. El cálculo adicional con compute_all() estaba
duplicando los impuestos cuando price_include estaba activado.
Cambios:
- Eliminado método _compute_price_with_taxes()
- Revertido eskaera_shop() para usar directamente _get_price()
- Revertido add_to_eskaera_cart() para usar directamente _get_price()
El precio mostrado ahora respeta la configuración de impuestos de Odoo
sin duplicación.
- Replace attrs syntax with new invisible attribute format
- Fix settings view inheritance to use sale.res_config_settings_view_form
- Add configuration setting in Sales > Pricing section
- Place automatic price pricelist setting after standard pricelist config
- Instalar pre-commit con 25 hooks configurados
- Configurar black 26.1.0 para formateo de código Python
- Configurar isort 7.0.0 para ordenación de imports
- Configurar flake8 7.3.0 con flake8-bugbear
- Configurar pylint 3.1.1 con pylint-odoo 9.1.2
- Añadir autoflake y pyupgrade para mejoras automáticas
- Configurar prettier para formateo de XML/JSON/YAML
- Crear .editorconfig para consistencia de editor
- Crear Makefile con comandos útiles
- Crear check_addon.sh para verificación rápida de addons
- Actualizar configuración de VS Code con extensiones recomendadas
- Añadir documentación completa de uso
- Aplicar formateo automático a archivos existentes
- Deshabilitar setuptools-odoo (no soporta Odoo 18.0 aún)
- Deshabilitar fix-encoding-pragma (obsoleto, usar pyupgrade)
- Fix _compute_price_rule: use 'quantity' positional parameter instead of 'qty'
- Fix stock_move: use 'quantity' instead of 'quantity_done' (Odoo 18 change)
- Fix _get_price return value: extract 'value' key directly from dict
- Add last_purchase_price related field in product.product for pricelist base
- Remove company_dependent+required conflict (use only company_dependent)
- Calculate list_price without taxes (taxes applied automatically on sales)
- Add comprehensive debug logging for price calculations
- Add action_update_list_price to compute theoretical price before updating
- Add 3 new tests for purchase price validation and zero price handling
- Fix _compute_price_rule to handle multiple tax amounts correctly
- Update manifest version to 18.0.1.0.0
- Update view inheritance to use Odoo 18 <block>/<setting> structure
- Update pricelist models for Odoo 18 API changes (qty parameter)
- Remove required=True from company_dependent field
- Add comprehensive test suite (33 tests)
- Tests cover: pricelist calculations, stock moves, product templates, and config settings
* Update module version to 18.0.1.0.0
* Remove view modifications as they are handled by parent modules
* Add comprehensive test suite (34 tests):
- Test triple discount mixin write() method behavior
- Test account.move.line with triple discounts
- Test purchase.order.line with triple discounts
* Add oca_dependencies.txt with required OCA repositories
* Fix write() method to handle explicit discounts correctly