Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error saving PDF in Knowledge Management

By
ton123
on 8/7/13, 10:56 AM 2,812 views

Saving .doc en .txt works ok in knowledge management. But when I try to save a document with the extension PDF results in an error. This is the case with any PDF file. I do not understand the traceback and how to solve this problem.

Traceback: OpenERP OpenERP Server Error Client Traceback (most recent call last): File "/var/packages/OpenERP7.x/target/openerp/addons/web/http.py", line 195, in dispatch response["result"] = method(self, *self.params) File "/var/packages/OpenERP7.x/target/openerp/addons/web/controllers/main.py", line 1079, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/var/packages/OpenERP7.x/target/openerp/addons/web/controllers/main.py", line 1071, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 43, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 31, in proxy_method result = self.session.send(self.service_name, method, *args) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 104, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 90, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/local/lib/python2.7/site-packages/openerp/netsvc.py", line 295, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/local/lib/python2.7/site-packages/openerp/service/web_services.py", line 614, in dispatch res = fn(db, uid, params) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 198, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/var/packages/OpenERP7.x/target/openerp/addons/document/document.py", line 121, in create vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) File "/var/packages/OpenERP7.x/target/openerp/addons/document/document.py", line 132, in _index mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None) TypeError: 'NoneType' object is not iterable

Same problem here with Project documents

Bert Zimpel
on 3/31/14, 11:10 AM
1
Mark Rosa
On 5/8/14, 8:19 AM

SYNOLOGY RELATED ISSUE: Since there is no method available (at least not without very deep hacking) to install the necessary poppler-utils on a Synology box, I just disabled the indexing fully using a hack I found on the launchpad buglist:

1) modify the file /var/packages/OpenERP7.x/target/openerp/addons/document/document.py

ORIGINAL CODE:

def create(self, cr, uid, vals, context=None):
    if context is None:
        context = {}
    vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
    # take partner from uid
    if vals.get('res_id', False) and vals.get('res_model', False) and not vals.get('partner_id', False):
        vals['partner_id'] = self.__get_partner_id(cr, uid, vals['res_model'], vals['res_id'], context)
    if vals.get('datas', False):
        vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None)
    return super(document_file, self).create(cr, uid, vals, context)

def _index(self, cr, uid, data, datas_fname, file_type):
    mime, icont = cntIndex.doIndex(data, datas_fname,  file_type or None, None)
    icont_u = ustr(icont)
    return mime, icont_u

MODIFIED CODE

def create(self, cr, uid, vals, context=None):
    if context is None:
        context = {}
    vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
    # take partner from uid
    if vals.get('res_id', False) and vals.get('res_model', False) and not vals.get('partner_id', False):
        vals['partner_id'] = self.__get_partner_id(cr, uid, vals['res_model'], vals['res_id'], context)
#    if vals.get('datas', False):
#        vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None)
    return super(document_file, self).create(cr, uid, vals, context)

def _index(self, cr, uid, data, datas_fname, file_type):
#    mime, icont = cntIndex.doIndex(data, datas_fname,  file_type or None, None)
#    icont_u = ustr(icont)
#    return mime, icont_u
        return False

2) restart OpenERP

Now the attachment upload should work for PDFs also.

WARNING 1: Absolutely no guarantee that this does not break something else!

WARNING 2: Make backups of the data and the code before you try this!

WARNING 3: This will disable indexing for ALL uploaded/attached documents!

0
Enzo F. Berger
On 5/19/15, 12:28 PM

Die Lösung für den Poppler-Utils Bug.

Was man benötigt

• 7z Zip-Programm (Google fragen)

• Putty (Google fragen)

• Kompilierte Version der Poppler-Utils (https://packages.debian.org/de/sid/poppler-utils)

Vorgehen

• Runterladen der korrekten Poppler-Utils. Dies ist abhängig von der CPU-Architektur. Für den Atom habe ich die AMD64 Version verwendet.

• Entpacken der Files bis nur doch die Verzeichnisstruktur – beginnend mit „usr“ - übrig ist. Hat man das nicht bereits auf der Disk Station gemacht, dann muss an die Verzeichnisse nun auf die DS verschieben.

• Mit der Putty einloggen. Als User verwendet man „root“ und das Passwort des Administrators.

• Nun sucht man mit dem Befehl „dir ..“ und „dir <Verzeichnis>“ die Poppler-Utils-Verzeichnisse.

• Nun kopiert man die Poppler-Utils-Verzeichnisse mit den Dateien wie folgt in das /usr Verzeichnis:

cp -r usr /

• Prüfen ob die Dateien in die richtigen Verzeichnisse kopiert wurden.

• Viel Spaß beim Upload von PDF-Dateien im OpenERP

Solution for the Poppler-Utils bug.

What you need

• 7z zip (ask google where to download)

• Putty (ask google where to download)

• Compiled file of poppler-utils (https://packages.debian.org/de/sid/poppler-utils)

Proceeding

• Download the correct archive of the poppler-utils depending on the CPU architectur in your Disk Station. For Atom use the AMD64 version. That worked fine for me.

• Unpack the files until you have the folder structure starting with "usr". If you haven't done that on the DS, move the folder “bin” and “share” with the files somewhere on the DS next.

• Login with the putty: Use "root" as user name and use your admin pass word.

• Move with "cd .." and "cd <folder name>" to the folder where you stored the poppler-utils-files.

• Copy the files to the root/usr folder like follows:

cp -r usr /

• Check if the files are correct in the folders.

• Enjoy uploading PDF files with OpenERP.

0
Bert Zimpel
On 3/31/14, 11:12 AM

Same probleme here with project documents:

OpenERP Server Error

Client Traceback (most recent call last): File "/var/packages/OpenERP7.x/target/openerp/addons/web/http.py", line 195, in dispatch response["result"] = method(self, *self.params) File "/var/packages/OpenERP7.x/target/openerp/addons/web/controllers/main.py", line 1079, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/var/packages/OpenERP7.x/target/openerp/addons/web/controllers/main.py", line 1071, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 43, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 31, in proxy_method result = self.session.send(self.service_name, method, *args) File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 104, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/var/packages/OpenERP7.x/target/openerp/addons/web/session.py", line 90, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/local/lib/python2.7/site-packages/openerp/netsvc.py", line 295, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/local/lib/python2.7/site-packages/openerp/service/web_services.py", line 614, in dispatch res = fn(db, uid, params) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 198, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/local/lib/python2.7/site-packages/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/var/packages/OpenERP7.x/target/openerp/addons/document/document.py", line 121, in create vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) File "/var/packages/OpenERP7.x/target/openerp/addons/document/document.py", line 132, in _index mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None) TypeError: 'NoneType' object is not iterable

The installation is running on a synology server, document management is installed. Any hint? Thank you!

SYNOLOGY RELATET ISSUE: OK i figured out poppler-utils are missing and needed to be installed. For this IPKG needs to be installed first, but I am still searching the poppler-utils file neccessary...

Bert Zimpel
on 3/31/14, 9:33 PM
0

Zum Installieren von IPKG siehe die SYNOLOGY Wiki: http://www.synology-wiki.de/index.php/IPKG

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 8/7/13, 10:56 AM
Seen: 2812 times
Last updated: 5/19/15, 12:28 PM