02.02.26
This commit is contained in:
@@ -62,6 +62,7 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
||||
def run_ocr(cls, docs):
|
||||
for doc in docs:
|
||||
try:
|
||||
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")
|
||||
@@ -81,6 +82,8 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
||||
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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -115,15 +115,17 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="controller"/>
|
||||
<button name="send" string="Send email to controller"/>
|
||||
<newline/>
|
||||
<label name="result"/>
|
||||
<field name="result"/>
|
||||
<label name="add_bl"/>
|
||||
<field name="add_bl"/>
|
||||
<newline/>
|
||||
<label name="add_invoice"/>
|
||||
<field name="add_invoice"/>
|
||||
<newline/>
|
||||
<label name="result"/>
|
||||
<field name="result"/>
|
||||
<newline/>
|
||||
<label name="instructions"/>
|
||||
<field name="instructions" widget="html_viewer" colspan="4" height="100"/>
|
||||
<label name="add_bl"/>
|
||||
<field name="add_bl"/>
|
||||
<field name="instructions" widget="Email" colspan="4" height="100"/>
|
||||
<newline/>
|
||||
<label name="returned_id"/>
|
||||
<field name="returned_id"/>
|
||||
|
||||
Reference in New Issue
Block a user