mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-25 01:48:41 -06:00
[ADD] cap the amount of documents to ocr per cronjob run
This commit is contained in:
parent
d4a07e88c5
commit
e5b00ee0d2
@ -8,6 +8,7 @@
|
|||||||
<field name="model">ir.attachment</field>
|
<field name="model">ir.attachment</field>
|
||||||
<field name="function">_ocr_cron</field>
|
<field name="function">_ocr_cron</field>
|
||||||
<field name="numbercall">-1</field>
|
<field name="numbercall">-1</field>
|
||||||
|
<field name="args">(100,)</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
@ -70,10 +70,10 @@ class IrAttachment(models.Model):
|
|||||||
return StringIO(stdout)
|
return StringIO(stdout)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _ocr_cron(self):
|
def _ocr_cron(self, limit=0):
|
||||||
for this in self.with_context(document_ocr_force=True).search([
|
for this in self.with_context(document_ocr_force=True).search([
|
||||||
('index_content', '=', _MARKER_PHRASE),
|
('index_content', '=', _MARKER_PHRASE),
|
||||||
]):
|
], limit=limit):
|
||||||
if not this.datas:
|
if not this.datas:
|
||||||
continue
|
continue
|
||||||
file_type, index_content = this._index(
|
file_type, index_content = this._index(
|
||||||
|
Loading…
Reference in New Issue
Block a user