Reordering Rules define minimum and maximum planned stock levels so that Odoo can propose what needs to be re-ordered. If you want to use this approach, it’s important to have Reordering Rules setup for all the affected products (e.g. all components).
It’s possible to use Automated Actions to setup Reordering Rules automatically at the time you create a product.
You need to know that:
- the reordering rules are stored in the Minimum Inventory Rule model (stock.warehouse.orderpoint)
- primary key is product
- we want to create one record for each product on the product.product table (don’t use the product template table product.template)
Start by enabling Developer mode and navigating to Settings / Technical / Automated Actions:
If you cannot find this option, you may need to install the module “Automated Action Rules”.
Click on CREATE and the following screen is displayed:
Action Name: Enter a description (e.g. Set reorder Point)
Model: Product (product.product)
Trigger Condition: On Creation
Apply on: Product Type = ‘product’ (because this does not apply to services or consumable items). See notes below on how to add this by clicking on “EDIT DOMAIN“.
Action To Do: Create a New Record
Create / Write Target Model: Minimum Inventory Rule (stock.warehouse.orderpoint)
Data to Write
Of course you can enter whatever values you want for minimum and maximum quantity in the first two lines, but the third line (for the product) must be exactly as shown above (and yes, a Python expression can be as simple as this).
It’s also possible to have different sets of minimum and maximum quantity for different types of product, though if your rules are more complex it may be better handled by doing development.
Note: in Odoo 14, there is an additional field “Trigger”, but this defaults to “Auto”, so there is no need to set it (unless you want replenishment to be manual).
You can also create this Automated Action as a Server Action to setup Reordering Rules for existing items.
This is easy to do. After clicking on “EDIT DOMAIN” (screenshot above), click on “Add Filter”
Click on that green button “Add Filter” and then you can select the fields you are going to use. We’ll select Product Type from the dropdown:
Only “Storable Products” can have Reordering Rules, so we will select that value (this is easy to do because it is a Selection Field).
Notice that it shows you the code that has been generated. You can directly edit this if you feel confident, and you can also copy it for use elsewhere.
Click on SAVE
You can add more complex domains if required. This is where you could specify that this rule applies to a specified product category (or several categories).