diff --git a/modules/automation/automation.py b/modules/automation/automation.py
index 7fd2bed..272798e 100644
--- a/modules/automation/automation.py
+++ b/modules/automation/automation.py
@@ -62,25 +62,28 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
def run_ocr(cls, docs):
for doc in docs:
try:
- # Décoder le fichier depuis le champ Binary
- file_data = doc.document.data or b""
- logger.info(f"File size: {len(file_data)} bytes")
- logger.info(f"First 20 bytes: {file_data[:20]}")
- logger.info(f"Last 20 bytes: {file_data[-20:]}")
+ if doc.type == 'weight_report':
+ # Décoder le fichier depuis le champ Binary
+ file_data = doc.document.data or b""
+ logger.info(f"File size: {len(file_data)} bytes")
+ logger.info(f"First 20 bytes: {file_data[:20]}")
+ logger.info(f"Last 20 bytes: {file_data[-20:]}")
- file_name = doc.document.name or "document"
+ file_name = doc.document.name or "document"
- # Envoyer le fichier au service OCR
- response = requests.post(
- "http://automation-service:8006/ocr",
- files={"file": (file_name, io.BytesIO(file_data))}
- )
- response.raise_for_status()
- data = response.json()
- logger.info("RUN_OCR_RESPONSE:%s",data)
- doc.ocr_text = data.get("ocr_text", "")
- doc.state = "ocr_done"
- doc.notes = (doc.notes or "") + "OCR done\n"
+ # Envoyer le fichier au service OCR
+ response = requests.post(
+ "http://automation-service:8006/ocr",
+ files={"file": (file_name, io.BytesIO(file_data))}
+ )
+ response.raise_for_status()
+ data = response.json()
+ logger.info("RUN_OCR_RESPONSE:%s",data)
+ doc.ocr_text = data.get("ocr_text", "")
+ doc.state = "ocr_done"
+ doc.notes = (doc.notes or "") + "OCR done\n"
+ else:
+ doc.ocr_text = (file_data or b'').decode('utf-8', errors='replace')
except Exception as e:
doc.state = "error"
diff --git a/modules/document_incoming_wr/document.py b/modules/document_incoming_wr/document.py
index d466eec..5ede120 100644
--- a/modules/document_incoming_wr/document.py
+++ b/modules/document_incoming_wr/document.py
@@ -50,7 +50,7 @@ class Incoming(metaclass=PoolMeta):
wr.state = 'draft'
WR.save([wr])
WR.run_ocr([wr])
- WR.run_metadata([wr])
+ # WR.run_metadata([wr])
return wr
diff --git a/modules/purchase_trade/view/shipment_in_form.xml b/modules/purchase_trade/view/shipment_in_form.xml
index 4791ecf..897381c 100755
--- a/modules/purchase_trade/view/shipment_in_form.xml
+++ b/modules/purchase_trade/view/shipment_in_form.xml
@@ -115,15 +115,17 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
+
+
+
+
-
-
-
+