OdooWiki OCA HUB

Sale order restricted quantity: min, max, multiple-of

sale_restricted_qty folder_open OCA/sale-workflow open_in_new
Sales Management License: AGPL-3

This module allows to set mininal, maximal, and multiple-of quantity constraints on product categories and products, and to check and optionally enforce these constraints on sale orders (either as strict blocking or soft warnings).

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Set minimum, maximum and multiple-of sales quantities on product categories and products, then check them on sale order lines with either a blocking error or a simple warning.

This module adds a "Sale Restricted Qty" section to product categories and product templates. For each of three rules — minimum quantity, maximum quantity and multiple-of quantity — you can tick a box to define your own value, or leave it unticked to inherit the value from the parent category. Each rule also has a "Restrict" setting with two choices: "Blocking" or "Warning".

On sale order lines, the values are copied from the product and the quantity is compared with them. If a rule is set to Blocking and the ordered quantity breaks it, saving the order raises an error listing the order, the product and the reason (for example "minimal quantity is 5" or "quantity should be multiple of 3"). If the rule is set to Warning, the line is only flagged internally and no error is raised.

When you pick a product whose minimum quantity is enforced, the line quantity is automatically filled with that minimum if it was empty or 1. Quantities are converted to the product's unit of measure before being checked, so different units are handled correctly.

Everything is configured from the product category form and the product form; the checks happen on sale.order.line records in draft or sent state.

Depends on

sale_management
Models and fields (5)
  • product.product · new model
  • sale.order.line · extends an existing modelmax_qty, min_qty, is_max_qty_set, is_min_qty_set, multiple_of_qty (Multiple-Of Qty), is_above_max_qty, is_below_min_qty, restrict_max_qty, restrict_min_qty, is_multiple_of_qty_set, is_not_multiple_of_qty, restrict_multiple_of_qty
  • product.category · new model
  • product.template · new model
  • sale.product.restricted.qty.mixin · new modelsale_max_qty, sale_min_qty, sale_own_max_qty, sale_own_min_qty, is_sale_max_qty_set, is_sale_min_qty_set, sale_multiple_of_qty, sale_restrict_max_qty, sale_restrict_min_qty, sale_inherited_max_qty, sale_inherited_min_qty, is_sale_own_max_qty_set, is_sale_own_min_qty_set, sale_own_multiple_of_qty, sale_own_restrict_max_qty, sale_own_restrict_min_qty, is_sale_multiple_of_qty_set, is_sale_restrict_max_qty_set, is_sale_restrict_min_qty_set, is_sale_inherited_max_qty_set, is_sale_inherited_min_qty_set, sale_restrict_multiple_of_qty, sale_inherited_multiple_of_qty, is_sale_own_multiple_of_qty_set, sale_inherited_restrict_max_qty, sale_inherited_restrict_min_qty, is_sale_own_restrict_max_qty_set, is_sale_own_restrict_min_qty_set, sale_own_restrict_multiple_of_qty, is_sale_restrict_multiple_of_qty_set

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. The module is very large and only part of the code was read. View the code on GitHub

Availability by version

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

Confirmation status: 5 confirmed, 4 with no information of 9 versions.

Sources · Odoo 14.0

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

terminal Installation and usage

OCA documentation · Odoo 18.0

To set quantity constraints on a product: navigate to Sales \> Products \> Products, open the product, and on the Sales tab in the Qty Constraints section set corresponding values in the Min Qty, Max Qty, or Multiple-Of Qty fields.

Constraint Types:

  • Min Qty: Minimum quantity required for a sale.
  • Max Qty: Maximum quantity allowed for a sale.
  • Multiple-Of Qty: Quantity must be a multiple of this value.

Enforcement Levels (Restrict): For each constraint, you can choose the enforcement level:

  • Blocking: Strictly enforces the rule. The user cannot confirm the line with an invalid quantity.
  • Warning: Displays a warning (yellow/orange indication) but allows the user to proceed.
  • Use Case: Use Warning when you want to allow flexibility, such as selling samples (below min qty) or clearing out leftover stock (remainder not matching multiple-of qty).

Auto-Suggest: When you select a product in a Sales Order line, if a Minimum Quantity is strictly enforced (Blocking) and the current quantity is not set (or is 0/1), the system will automatically populate the quantity with the Minimum Quantity.

To set quantity constraints on a product variant: navigate to Sales \> Products \> Product Variants, open the product variant, and on the Sales tab in the Qty Constraints section set corresponding values.

To set quantity constraints on a product category: navigate to Sales \> Configuration \> Product Categories, open the product category, and in the Sales Qty Constraints section set corresponding values.

The settings are inherited from the product category to the product, and from the product to the product variant. To override the inherited settings, check the checkbox next to the corresponding value and set the value in the product or product variant.

No verified information in OCA: Installation, Configuration.

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.