diff --git a/attachment_file_type/data/ir_cron.xml b/attachment_file_type/data/ir_cron.xml
index 4911b9f1..dccde8c5 100644
--- a/attachment_file_type/data/ir_cron.xml
+++ b/attachment_file_type/data/ir_cron.xml
@@ -11,7 +11,7 @@
ir.attachment
update_file_type_from_cron
- (1000,)
+ (10000,)
diff --git a/attachment_file_type/models/ir_attachment.py b/attachment_file_type/models/ir_attachment.py
index 26ec2bf9..4488da9a 100644
--- a/attachment_file_type/models/ir_attachment.py
+++ b/attachment_file_type/models/ir_attachment.py
@@ -26,13 +26,19 @@ from base64 import b64decode
class Attachment(orm.Model):
_inherit = 'ir.attachment'
- def update_file_type_from_cron(self, cr, uid, count=1000, context=None):
+ def update_file_type_from_cron(self, cr, uid, count=10000, context=None):
ids = self.search(
cr, uid, [('file_type', '=', False)], context=context)
logging.getLogger('openerp.addons.attachment_file_type').info(
'Found %s attachments without file type in the database.',
len(ids))
- self.update_file_type(cr, uid, ids, force=True, context=None)
+ if ids:
+ logging.getLogger('openerp.addons.attachment_file_type').info(
+ 'Providing file types for a maximum of %s of them',
+ count)
+ return self.update_file_type(
+ cr, uid, ids[:count], force=True, context=None)
+ return False
def update_file_type(self, cr, uid, ids, force=False, context=None):
""" Write the file types for these attachments. If the document module