excel识别
This commit is contained in:
@@ -4,7 +4,6 @@ AI 附件导入记录模型
|
||||
记录每次 Excel/图片 附件的识别结果,支持后台查看和重新导入
|
||||
"""
|
||||
from odoo import models, fields, api
|
||||
from odoo import tools
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -72,7 +71,8 @@ class AiImportRecord(models.Model):
|
||||
for rec in self:
|
||||
prefix = dict(self._fields['file_type'].selection).get(rec.file_type, '文件')
|
||||
time_str = rec.create_date.strftime('%m-%d %H:%M') if rec.create_date else ''
|
||||
rec.name = u'{prefix} - {rec.filename or "未命名"} - {time_str}'
|
||||
fname = rec.filename or '未命名'
|
||||
rec.name = f'{prefix} - {fname} - {time_str}'
|
||||
|
||||
def action_reparse(self):
|
||||
"""重新解析附件(管理员手动触发)"""
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
decoration-success="ocr_status == 'success'"
|
||||
decoration-warning="ocr_status == 'failed'"
|
||||
decoration-info="ocr_status == 'pending'"/>
|
||||
<field name="ocr_error" attrs="{'invisible': [('ocr_error', '=', '')]}"/>
|
||||
<field name="ocr_error" invisible="not ocr_error"/>
|
||||
<field name="import_status" widget="badge"/>
|
||||
<field name="import_rule_id"/>
|
||||
</group>
|
||||
@@ -175,10 +175,10 @@
|
||||
<field name="target_model" placeholder="如:hr.employee"/>
|
||||
<field name="import_mode"/>
|
||||
<field name="unique_key" placeholder="如:id_card"
|
||||
attrs="{'invisible': [('import_mode', '=', 'create')]}"/>
|
||||
invisible="import_mode == 'create'"/>
|
||||
</group>
|
||||
<group string="字段映射(JSON格式)">
|
||||
<field name="field_mapping" nolabel="1" widget="ace"
|
||||
<field name="field_mapping" nolabel="1" widget="code"
|
||||
options="{'mode': 'json'}"
|
||||
placeholder='{"Excel列名": "odoo字段名"} 范例:{"姓名": "name", "手机号": "mobile_phone"}'/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user