top of page
Search
  • Chris Tringham

Create Reordering Rules by using Automated Actions

Updated: Nov 25, 2019

There's a newer version of this post here: https://odootricks.tips/automated-actions-reordering-rules/



The requirement is to automatically create Reordering Rules when you create a product.


You need to know that

  1. the reordering rules are stored in the Minimum Inventory Rule model (stock.warehouse.orderpoint)

  2. this model (table) has a primary key of product

  3. 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 debug mode and navigating to Settings / Technical / Automated Actions:

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


Minimum Quantity (stock.warehouse.orderpoint) Value 0

Maximum Quantity (stock.warehouse.orderpoint) Value 10

Product (stock.warehouse.orderpoint) Python expression record.id

Of course you can enter whatever values you want for minimum and maximum quantity. The third line (for the product) must be exactly as shown above.


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 this may be better handled by doing development.


Edit domain

This is easy to do. After clicking on "EDIT DOMAIN" (screenshot above), click on "Add Filter"

Then select the Product Type field from the dropdown








Select "Storable Product"

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).


195 views0 comments

Recent Posts

See All

Server Actions to copy (and delete)

There's a newer version of this post here: https://odootricks.tips/server-actions-copy-delete/ An interesting use of Server Actions to copy (and delete) multiple records. This is another one from Jake

Automated Action to create a BOM

There's a newer version of this post here: https://odootricks.tips/about/automated-action-to-create-a-bom/ This is a great example of the power of Automated Actions to do something useful. Credit to J

bottom of page