diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py index 51a386fce34..e15a685c794 100644 --- a/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py @@ -156,7 +156,10 @@ class IrAttachment(models.Model): cr = self._cr cr.commit() - # prevent all concurrent updates on ir_attachment while collecting! + # prevent all concurrent updates on ir_attachment while collecting, + # but only attempt to grab the lock for a little bit, otherwise it'd + # start blocking other transactions. (will be retried later anyway) + cr.execute("SET LOCAL lock_timeout TO '10s'") cr.execute("LOCK ir_attachment IN SHARE MODE") # retrieve the file names from the checklist