diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-12-04 16:28:25 +0000 |
|---|---|---|
| committer | Rémy Voet (ryv) <ryv@odoo.com> | 2020-12-22 14:32:12 +0000 |
| commit | 0a3bf1811cfbfa49257bf1e63346d19acbdc8e1c (patch) | |
| tree | 73ae576126c0dff5e41b7c1f9249991085df968d | |
| parent | bd18b6ac6f551e6e470961113f833dd756fcaf39 (diff) | |
[FIX] stock: avoid flush all env in quants update
About this commit 8e7c0e544a8d3d18c57634750ee7ea03052c84b1
We need to manually invalidate the cache (of the quant) if a error
(other than concurrent ones) is raise from the write. Because
we can't know what the `write` has already put in the cache (e.g.
`write_uid`), we need invalidate it.
opw-2371161
| -rw-r--r-- | addons/stock/models/stock_quant.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index c3da6ee07e5..20aa77a628d 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -424,6 +424,9 @@ class StockQuant(models.Model): if e.pgcode == '55P03': # could not obtain the lock continue else: + # Because savepoint doesn't flush, we need to invalidate the cache + # when there is a error raise from the write (other than lock-error) + self.clear_caches() raise else: self.create({ |
