나는 python-docx를 사용하여 docx 파일을 구문 분석 한 다음 xmlrpc를 사용하여 odoo res.partner에 내용을 씁니다. 여기 내 코드입니다 :odoo 8 xmlrpc가 전체 텍스트를 쓸 수 없다
# -*- coding: utf-8 -*-
from os import listdir
from os.path import isfile, join
from docx import Document
import xmlrpclib
username = 'admin' #the user
pwd = 'password' #the password of the user
dbname = 'odoo8_win' #the database
# OpenERP Common login Service proxy object
sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
uid = sock_common.login(dbname, username, pwd)
#replace localhost with the address of the server
# OpenERP Object manipulation service
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
mypath="D:\py_test_files"
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
#open doc
for file in onlyfiles:
cv_name = mypath + '\\' + file
name = file
document = Document(cv_name)
l = [ paragraph.text.encode('utf-8') for paragraph in document.paragraphs];
for i in l:
cv = u"".join(i.decode('utf-8'))
print cv # correct without problems
partner = {
'name': name,
'cv': cv,
}
#calling remote ORM create method to create a record
partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
이력서 샘플 :
교육 관리 사업의 싱가포르 학사의
대학교
내가 odoo에 로그인 할 때이 파이썬을 실행 오류가 없다 필드를 확인하기 위해서만 마지막 단락을 볼 수 있습니다 :
싱가포르 University of Singapore 경영학 학사
이 문제를 불쾌하게하는 방법에 대해 도움을 요청할 수 있습니까? 코드에 대해서는
감사합니다 Tejas Tank, 샘플을 사용하는 경우 작동합니다. 그래서 전 cv를 풀 텍스트에 추가해야한다는 것을 알았습니다. 문제가 해결되었습니다. – ITGeeker