addons-cm/product_sale_price_from_pricelist
snt 10ae5bcbf6 [FIX] product_sale_price_from_pricelist: Correct _compute_price method signature
- 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
2026-02-16 15:26:22 +01:00
..
i18n product_sale_price_from_pricelist: fix tranlations 2025-07-09 17:57:10 +02:00
migrations [FIX] product_sale_price_from_pricelist: Convert JSONB columns in product_template too 2026-02-14 18:15:15 +01:00
models [FIX] product_sale_price_from_pricelist: Correct _compute_price method signature 2026-02-16 15:26:22 +01:00
tests [FIX] product_sale_price_from_pricelist: migrate data and add diagnostic tests 2026-02-12 19:51:23 +01:00
views Add update price button with notification to product views 2026-02-11 21:04:18 +01:00
__init__.py add product_sale_price_from_pricelist 2025-02-04 21:15:51 +01:00
__manifest__.py [FIX] product_sale_price_from_pricelist: Protect Float computed fields 2026-02-14 18:20:20 +01:00
CHANGELOG.md [FIX] product_sale_price_from_pricelist: Protect Float computed fields 2026-02-14 18:20:20 +01:00
README.md [REF] product_sale_price_from_pricelist: Move fields to product.product 2026-02-12 18:18:44 +01:00

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

  1. Settings > Sales > Automatic Price Configuration: Select the pricelist for automatic price calculation
  2. 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

  1. Products are priced when received from purchase orders
  2. System automatically updates last_purchase_price field
  3. Sale price is calculated from the configured pricelist using the cost price
  4. Taxes are automatically applied based on product tax settings
  5. 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 needed
  • list_price_theoritical (Float): Calculated theoretical price
  • last_purchase_price_received (Float): Last purchase price received
  • last_purchase_price_compute_type (Selection): How to calculate price
  • _compute_theoritical_price(): Main price calculation method
  • action_update_list_price(): Update sale price from theoretical

product.template (Related fields)

  • All fields are related to product_variant_id fields
  • 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