Ich benutze python-docx, um docx-Datei zu analysieren, dann benutze xmlrpc, um Inhalt in odoo res.partner zu schreiben. Hier ist mein Code:odoo 8 xmlrpc kann nicht ganzen Text schreiben
# -*- 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)
cv Beispiel:
Bildung
National University of Singapore Bachelor of Business Administration
Es ist kein Fehler, wenn dieser Python ausführen, wenn ich in odoo anmelden das Feld zu überprüfen, kann nur letzten Absatz sehen:
Nationale Universität Von Singapur Bachelor Of Business Administration
Darf ich um Hilfe bitten, um dieses Problem zu lösen?
Dank Tejas Tank, wenn Sie Ihre Probe verwenden, funktioniert es. So fand ich, dass ich meinen Lebenslauf an einen vollen Text anhängen muss. das Problem wurde gelöst. – ITGeeker