mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-24 17:38:42 -06:00
[IMP] don't read all attachments at once
This commit is contained in:
parent
b61d73b42a
commit
34edbeec18
@ -89,10 +89,12 @@ class IrAttachment(Model):
|
|||||||
cr, uid, [('db_datas', '!=', False)], limit=limit, context=context)
|
cr, uid, [('db_datas', '!=', False)], limit=limit, context=context)
|
||||||
logging.info('moving %d attachments to filestore', len(attachment_ids))
|
logging.info('moving %d attachments to filestore', len(attachment_ids))
|
||||||
counter = 1
|
counter = 1
|
||||||
for attachment_data in ir_attachment.read(
|
# attachments can be big, so we read every attachment on its own
|
||||||
cr, uid, attachment_ids, ['datas'], context=context):
|
for attachment_id in attachment_ids:
|
||||||
|
attachment_data = ir_attachment.read(
|
||||||
|
cr, uid, [attachment_id], ['datas'], context=context)[0]
|
||||||
ir_attachment.write(
|
ir_attachment.write(
|
||||||
cr, uid, [attachment_data['id']],
|
cr, uid, [attachment_id],
|
||||||
{
|
{
|
||||||
'datas': attachment_data['datas'],
|
'datas': attachment_data['datas'],
|
||||||
'db_datas': False,
|
'db_datas': False,
|
||||||
|
Loading…
Reference in New Issue
Block a user