Commit graph

3 commits

Author SHA1 Message Date
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
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
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