Odoo Help


ProgrammingError: can't adapt type 'document.directory'

David Verove
on 11/7/14, 10:03 AM 3,770 views


I get the following error when accessing a property of object document.directory :


dir_file_obj = self.pool.get('document.directory').browse(cr, uid, doc_id, context=context)

_logger.info("16 : %r", dir_file_obj.path) 

if dir_file_obj.path:


In log :

2014-11-07 10:12:47,085 18941 ERROR dev openerp.sql_db: Programming error: can't adapt type 'document.directory', in query  SELECT document_directory."create_uid",document_directory."domain",document_directory."create_date",document_directory."ressource_type_id",document_directory."resource_field",document_directory."inode",document_directory."company_id",document_directory."write_uid",document_directory."parent_id",document_directory."resource_find_all",document_directory."ressource_parent_type_id",document_directory."write_date",document_directory."path",document_directory."ressource_tree",document_directory."user_id",document_directory."ressource_id",document_directory."type",document_directory."id",document_directory."name" FROM "document_directory"

                    WHERE document_directory.id IN %s AND (TRUE)
                    ORDER BY name


2014-11-07 14:57:23,975 2324 ERROR dev openerp.addons.base.ir.ir_cron: Call of self.pool.get('import_dossier').batch_import(cr, uid, *(False,)) failed in Job 9
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_cron.py", line 138, in _callback
    getattr(model, method_name)(cr, uid, *args)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/addons/documents_aneosys/import_dossier.py", line 130, in batch_import
    self.traite_fichiers(cr, uid, root, files, context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/addons/documents_aneosys/import_dossier.py", line 228, in traite_fichiers
    _logger.info("16 : %r", dir_file_obj.path)
  File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 760, in __get__
  File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 853, in determine_value
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 3169, in _prefetch_field
    result = records.read(list(fnames), load='_classic_write')
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 3114, in read
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 3226, in _read_from_database
    cr.execute(query, [tuple(sub_ids)] + rule_params)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 158, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
  File "/usr/lib/python2.7/dist-packages/psycopg2/extensions.py", line 129, in getquoted
    pobjs = [adapt(o) for o in self._seq]
ProgrammingError: can't adapt type 'document.directory'


I can't access any property except id, is it a bug from v8?



David Verove
On 11/7/14, 10:31 AM

Found, the error was from doc_id, which is an external key, I fixed it with : 


dir_file_obj = self.pool.get('document.directory').browse(cr, uid, doc_id.id, context=context)

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 11/7/14, 10:03 AM
Seen: 3770 times
Last updated: 3/16/15, 8:10 AM