Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
base_exception: Remove side effect from api.constrains
In the documentation. The method called by '_check_exception' has a side effect, it writes on 'exception.rule' + on the Many2many relation between it and the related model (such as sale.order). When decorated by @api.constrains, any error during the method will be caught and re-raised as "ValidationError". This part of code is very prone to concurrent updates as 2 sales having the same exception will both write on the same 'exception.rule'. A concurrent update (OperationalError) is re-raised as ValidationError, and then is not retried properly. Calling the same method in create/write has the same effect than @api.constrains without shadowing the exception type. Full explanation: OCA#1642
- Loading branch information