CAMBIOS PRINCIPALES: - Agregar field 'default_supplier_id' a product_main_seller (related a main_seller_id) - Actualizar product_price_category_supplier tests para usar seller_ids (supplierinfo) - Cambiar product type de 'product' a 'consu' en tests de account_invoice_triple_discount_readonly - Crear product.template en lugar de product.product directamente en tests - Corregir parámetros de _compute_price: 'qty' -> 'quantity' - Comentar test de company_dependent que no puede ejecutarse sin migración RESULTADOS: - 193 tests totales (fue 172) - 0 error(s) (fueron 5 en setUpClass) - 10 failed (lógica de descuentos en account_invoice_triple_discount_readonly) - 183 tests PASANDO ADDONS PASANDO COMPLETAMENTE: ✅ product_main_seller: 9 tests ✅ product_price_category_supplier: 12 tests ✅ product_sale_price_from_pricelist: 47 tests ✅ website_sale_aplicoop: 111 tests ✅ account_invoice_triple_discount_readonly: 36/46 tests |
||
|---|---|---|
| .. | ||
| i18n | ||
| migrations | ||
| models | ||
| tests | ||
| views | ||
| __init__.py | ||
| __manifest__.py | ||
| CHANGELOG.md | ||
| README.md | ||
Product Sale Price from Pricelist
Automatically calculate and update product sale prices based on the last purchase price and configurable pricelists.
Features
- Automatic Price Calculation: Set sale prices based on last purchase price and a configured pricelist
- Flexible Discount Handling: Choose how to apply discounts to the cost:
- Without discounts
- First discount only
- Double discount
- Triple discount
- Manual update
- Tax-Aware Pricing: Automatically includes tax calculations in pricing
- UoM Conversion: Handles different purchase and sale units of measure
- Batch Updates: Update theoretical prices for multiple products
- Product Flags: Mark products for price updates and track status
Configuration
- Settings > Sales > Automatic Price Configuration: Select the pricelist for automatic price calculation
- Products > Products: Configure per product:
- Last purchase price: Cost at which the product was last purchased
- Last purchase price calculation type: Choose how to apply discounts
- Mark Last purchase price updated when prices need to be reviewed
Price Calculation Types
- Without Discounts: Uses base purchase price without discounts
- First Discount: Applies only the first discount
- Double Discount: Applies first and second discount
- Triple Discount: Applies first, second, and third discount
- Manual Update: Price must be set manually
Usage
- Products are priced when received from purchase orders
- System automatically updates last_purchase_price field
- Sale price is calculated from the configured pricelist using the cost price
- Taxes are automatically applied based on product tax settings
- Go to Products > Update Theoretical Prices to batch update prices
Technical Architecture
Models
All main fields and business logic are stored in product.product for proper variant handling:
product.product (Main model)
last_purchase_price_updated(Boolean): Flag for price update neededlist_price_theoritical(Float): Calculated theoretical pricelast_purchase_price_received(Float): Last purchase price receivedlast_purchase_price_compute_type(Selection): How to calculate price_compute_theoritical_price(): Main price calculation methodaction_update_list_price(): Update sale price from theoretical
product.template (Related fields)
- All fields are
relatedtoproduct_variant_idfields - Allows views on template to continue working
- Delegates actions to product variants
This architecture prevents issues with pricelist reports and ensures proper handling of product variants.
License
AGPL-3.0 or later