Skip to Content

Python Formula for Dynamic Prices in Purchase

Compute purchase order line prices dynamically using Python formulas defined in vendor pricelists
128.87 € 128.87 € (Tax excluded)
US$ 150.00 (Tax excluded)

  • Versions
Terms and Conditions
30-day money-back guarantee
Shipping: 2-3 Business Days
Versions: V19

ODOO'S FUNCTION

By default, Odoo supports product pricing through vendor pricelists with fixed prices. However, it does not support custom pricing logic or dynamic calculation.

CLUEDOO'S FUNCTION

CLuedoo provides dynamic pricing capabilities for  orders using Python code formulas defined in pricelists. This allows businesses to compute prices based on custom logic and apply them instantly across all Purchase Order Lines with a single click.

CONFIGURATION

Go to Purchase > Configuration > Vendor Pricelists > Open or create a  pricelist > Enable the Use Python Formula checkbox  then write your formula in the script box.

Example: For Large Cabinet, the formula result = 100 if OL.product_uom_qty > 5 else 150 means set the unit price to 100 if the quantity is greater than 5; otherwise, set the unit price to 150.

USAGE

Create a new Purchase Order using the vendor pricelist you just configured > The formula is automatically inherited by each Purchase Order Line

At this point, the unit price still shows the original value. The formula is ready but not yet applied.

Hit the Calculate Price button at the top of the Purchase Order > The system instantly recomputes the unit price for all lines based on their formula.


Notes: 

  • You can edit the formula directly on the Purchase Order Line - the system will use the line's formula when calculating, not the pricelist's.
  • Prices are not updated automatically - you need to click Calculate Price each time you want to recompute.