From 8973f8a6d0ae61a3eb2e7692924ee06a2ac9ea4c Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 19 Jul 2026 22:52:21 +0200 Subject: [PATCH] Faircot process --- modules/document_incoming/document.py | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/modules/document_incoming/document.py b/modules/document_incoming/document.py index 07825d1..acd23d1 100755 --- a/modules/document_incoming/document.py +++ b/modules/document_incoming/document.py @@ -295,23 +295,60 @@ class Incoming(DeactivableMixin, Workflow, ModelSQL, ModelView): @ModelView.button @Workflow.transition('processing') def process(cls, documents, with_children=False): + logger.info( + "DOCUMENT_INCOMING_PROCESS_CLICK documents=%s with_children=%s", + [ + { + 'id': document.id, + 'name': document.name, + 'type': document.type, + 'state': document.state, + } + for document in documents + ], + with_children) transaction = Transaction() context = transaction.context with transaction.set_context( queue_batch=context.get('queue_batch', True)): + logger.info( + "DOCUMENT_INCOMING_PROCESS_QUEUE documents=%s queue_batch=%s", + [document.id for document in documents], + transaction.context.get('queue_batch')) cls.__queue__.proceed(documents, with_children=with_children) @classmethod @ModelView.button @Workflow.transition('done') def proceed(cls, documents, with_children=False): + logger.info( + "DOCUMENT_INCOMING_PROCEED_START documents=%s with_children=%s", + [ + { + 'id': document.id, + 'name': document.name, + 'type': document.type, + 'state': document.state, + 'active': document.active, + 'result': str(document.result) if document.result else None, + } + for document in documents + ], + with_children) pool = Pool() Attachment = pool.get('ir.attachment') results = defaultdict(list) attachments = [] for document in documents: if document.result or not document.active: + logger.info( + "DOCUMENT_INCOMING_PROCEED_SKIP document=%s " + "result=%s active=%s", + document.id, document.result, document.active) continue + logger.info( + "DOCUMENT_INCOMING_PROCEED_DISPATCH document=%s method=%s", + document.id, f'_process_{document.type}') document.result = getattr(document, f'_process_{document.type}')() results[document.result.__class__].append(document.result) attachment = Attachment(