ValueError: a string literal cannot contain nul (0x00) characters

Asked by Mouna

I cannot understand the error, because already I installed the module on odoo10, ubuntu 14 and it works fine, but when I installed it on odoo10, ubuntu 16 and I tried to work with it gives me this error

> File "/home/belazar/Documents/addons_odoo10/hr_biometric_machine/models/biometric_machine.py", line 113, in create_user
    'biometric_device': self.id, }
  File "/opt/odoo/odoo/models.py", line 3830, in create
    record = self.browse(self._create(old_vals))
  File "/opt/odoo/odoo/models.py", line 3925, in _create
    cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
  File "/opt/odoo/odoo/sql_db.py", line 154, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/odoo/odoo/sql_db.py", line 231, in execute
    res = self._obj.execute(query, params)
ValueError: A string literal cannot contain NUL (0x00) characters.

Question information

Language:
French Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Mouna
Solved:
Last query:
Last reply:
Revision history for this message
Mouna (sos-mouna) said :
#1

the problem is solved by on /opt/odoo/odoo/sql_db.py commenting those lines:

#from tools import parse_version as pv
#if pv(psycopg2.__version__) < pv('2.7'):
# from psycopg2._psycopg import QuotedString
  # def adapt_string(adapted):
   # """Python implementation of psycopg/psycopg2#459 from v2.7"""
    # if '\x00' in adapted:
     # raise ValueError("A string literal cannot contain NUL (0x00) characters.")
      # return QuotedString(adapted)

    #psycopg2.extensions.register_adapter(str, adapt_string)
    #psycopg2.extensions.register_adapter(unicode, adapt_string)