Browse Source
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/server-tools#164210.0
Guewen Baconnier
5 years ago
1 changed files with 33 additions and 7 deletions
Loading…
Reference in new issue