Community: Inventory and MRP mailing list archives

Re: Disabling location + Inactive location in stock analysis

Pedro M. Baeza
- 08/05/2015 12:54:47
Olivier, I tend to agree with you, but in this case, such constraint is a must for ensuring integrity. You already do this kind of things on core when you don't allow to remove a confirmed sale order or to change stock level on a template instead of a product variant, or a more importante one: do not allow to change the UoM on a product if it has any stock (although this one is still pending, because now it locks always, but not introducing this constraint has produced me a lot of headaches on 6.0 DBs).

They are called business rules, and I think that they're very important to an ERP and it must be deployed with the core. Also, this constraint is not going to produce too much performance issues, as it's only evaluated on active=False.


2015-08-05 18:48 GMT+02:00 Olivier Dony <>:
On 08/05/2015 05:37 PM, Maxime Chambreuil wrote:
> We will just fix them then and create a pull request.

It is usually best to avoid hardcoding such constraints, they can make it very 
tedious to deactivate records when you have a good reason to do it. And they 
cannot be temporarily disabled.

In most cases, users who deactivate master data records (Customers/Suppliers, 
Products, Locations, ...) know what they are doing. They also know that this 
action is not meant to hide all related documents/transactions. Only the record 
itself gets hidden from lists and auto-completions. And it is trivial to undo.

This case is no exception to the rule, and follows the usual Odoo semantics.

If one of your customer makes regular mistakes with this, why not write a 
2-line automated action (base_action_rule module) that raises an error whenever 
the conditions are not meant. Then post that recipe here or on the forum?


Post to: