OdooWiki OCA HUB

Sale line locking by pricelist

sale_order_line_price_lock_by_pricelist folder_open OCA/sale-workflow open_in_new
Sales Management License: LGPL-3

This module allows to lock price edition based on the applied pricelist rule scope.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Lets you lock the unit price and discount on sales order lines based on the pricelist rule scope, so salespeople cannot change prices that come from a pricelist rule you want to protect.

This module adds a new setting on each pricelist called "Lock price when rule is applied on". You can choose the scope that should be protected: All products, Product Category, Product, or Product Variant.

On a sales order, the module checks each line against the pricelist rule that actually produced its price. If that rule's scope matches or is narrower than the lock setting, the line is flagged as locked and the unit price and discount fields become read-only in both the list and form views of the order lines.

  • Sales managers (users in the Sales Manager group) are exempt: they can still edit prices even when a line is locked.
  • The check follows pricelist inheritance chains, so rules based on another pricelist are traced back to their original rule.
  • If no specific rule is found and the pricelist is set to lock "All products", the line is locked as well.

The module touches product.pricelist (new lock setting and a helper to find the base rule) and sale.order.line (two computed technical fields: the origin pricelist item and the lock flag). It adds the new setting to the pricelist form and makes the price fields read-only on the sale order form and list.

Depends on

sale
Models and fields (2)
  • sale.order.line · extends an existing modelprice_locked, origin_pricelist_item_id
  • product.pricelist · extends an existing modellock_product_prices_applied_on (Lock price when rule is applied on)

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 16.0

Confirmed on 2026-11-03 in branch 16.0 of OCA/sale-workflow.

terminal Installation and usage

OCA documentation · Odoo 18.0

In order to configure the prices lock scope, go to the pricelist you want to configure or create a new one from Sales > Products > Pricelists.

Now, in the Configuration tab, you can set the scope on the field **Lock product prices applied on*. The possible options are:

  • All products: any rule will lock the price. Very restrictive.
  • Product category: all the rules applied on product category, product or variants will lock the price.
  • Product: all the rules applied on product or variants will lock the price.
  • Product variant: only the rules applied on variants will lock the price.

For this example, we'll choose the Product scope.

Then, in the price rules, we'll add a fixed price of 80 to be applied on the product FURN_5555. Save and close and go to the Usage section to test it in the sales order.

To use this module, you need to log in as a salesman (i.e.: demo user), as sales manager won't be locked. Then:

  • Create a new sales order.
  • Chose the pricelist we configured before.
  • Add the product FURN_5555: you'll see that the price unit is locked.
  • Add another product: the price unit can be edited for that line.
  • Change the pricelist: now you can edit the price for FURN_5555 again.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.