This question has been flagged

Hi, when I try to initialize the DB I get the following errors:

$ python odoo-bin --addons-path=addons  -i base

....
2021-07-14 04:46:48,122 6452 INFO borch odoo.modules.loading: loading base/data/res.lang.csv 2021-07-14 04:46:48,185 6452 INFO borch odoo.modules.loading: loading base/data/res_lang_data.xml 2021-07-14 04:46:48,195 6452 INFO borch odoo.modules.loading: loading base/data/res_partner_data.xml 2021-07-14 04:46:48,339 6452 INFO borch odoo.modules.loading: loading base/data/res_company_data.xml 2021-07-14 04:46:48,359 6452 INFO borch odoo.modules.loading: loading base/data/res_users_data.xml 2021-07-14 04:46:48,570 6452 INFO borch odoo.modules.loading: loading base/data/report_paperformat_data.xml 2021-07-14 04:46:48,578 6452 INFO borch odoo.modules.loading: loading base/data/res_currency_data.xml 2021-07-14 04:46:48,981 6452 INFO borch odoo.modules.loading: loading base/data/res_country_data.xml 2021-07-14 04:46:50,597 6452 INFO borch odoo.modules.loading: loading base/data/ir_demo_data.xml 2021-07-14 04:46:50,625 6452 ERROR borch odoo.sql_db: bad query: UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')ERROR: relation "ir_module_module" does not existLINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN... ^ 2021-07-14 04:46:50,625 6452 ERROR borch odoo.modules.registry: Failed to load registry Traceback (most recent call last): File "/home/borch/odoo/odoo/models.py", line 1128, in _validate_fields check(self) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 343, in _check_xml view_arch = etree.fromstring(view.arch.encode('utf-8')) File "src/lxml/etree.pyx", line 3213, in lxml.etree.fromstring File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument File "src/lxml/parser.pxi", line 1765, in lxml.etree._parseDoc File "src/lxml/parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError File "", line 24lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 24, column 9
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/tools/convert.py", line 758, in parse self._tags[rec.tag](rec, de, mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 663, in _tag_record record = model.with_context(rec_context)._load_records([data], self.mode == 'update') File "/home/borch/odoo/odoo/models.py", line 3910, in _load_records records = self._load_records_create([data['values'] for data in to_create]) File "/home/borch/odoo/odoo/models.py", line 3824, in _load_records_create return self.create(values) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 428, in create return super(View, self).create(vals_list) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/models.py", line 3641, in create fields[0].determine_inverse(batch_recs) File "/home/borch/odoo/odoo/fields.py", line 1200, in determine_inverse getattr(records, self.inverse)() File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch view.write(data) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 445, in write res = super(View, self).write(self._compute_defaults(vals)) File "/home/borch/odoo/odoo/models.py", line 3366, in write self._write(store_vals) File "/home/borch/odoo/odoo/models.py", line 3502, in _write self._validate_fields(vals) File "/home/borch/odoo/odoo/models.py", line 1132, in _validate_fields raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))odoo.exceptions.ValidationError: ('Error while validating constraint\n\nExtra content at the end of the document, line 24, column 9', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/modules/registry.py", line 86, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/borch/odoo/odoo/modules/loading.py", line 360, in load_modules loaded_modules, processed_modules = load_module_graph( File "/home/borch/odoo/odoo/modules/loading.py", line 222, in load_module_graph load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/borch/odoo/odoo/modules/loading.py", line 68, in load_data tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/borch/odoo/odoo/tools/convert.py", line 802, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/borch/odoo/odoo/tools/convert.py", line 865, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 761, in parse pycompat.reraise( File "/home/borch/odoo/odoo/tools/pycompat.py", line 86, in reraise raise value.with_traceback(tb) File "/home/borch/odoo/odoo/tools/convert.py", line 758, in parse self._tags[rec.tag](rec, de, mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 663, in _tag_record record = model.with_context(rec_context)._load_records([data], self.mode == 'update') File "/home/borch/odoo/odoo/models.py", line 3910, in _load_records records = self._load_records_create([data['values'] for data in to_create]) File "/home/borch/odoo/odoo/models.py", line 3824, in _load_records_create return self.create(values) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 428, in create return super(View, self).create(vals_list) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/models.py", line 3641, in create fields[0].determine_inverse(batch_recs) File "/home/borch/odoo/odoo/fields.py", line 1200, in determine_inverse getattr(records, self.inverse)() File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch view.write(data) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 445, in write res = super(View, self).write(self._compute_defaults(vals)) File "/home/borch/odoo/odoo/models.py", line 3366, in write self._write(store_vals) File "/home/borch/odoo/odoo/models.py", line 3502, in _write self._validate_fields(vals) File "/home/borch/odoo/odoo/models.py", line 1132, in _validate_fields raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))odoo.tools.convert.ParseError: "Error while validating constraint
Extra content at the end of the document, line 24, column 9None" while parsing /home/borch/odoo/odoo/addons/base/data/ir_demo_data.xml:9, near ir.demo.form ir.demo

  Danger Zone

Demo data should only be used on test databases! Once they are loaded, they cannot be removed!

Please confirm that you want to irreversibly make this database a demo database.



During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/modules/registry.py", line 88, in new odoo.modules.reset_modules_state(db_name) File "/home/borch/odoo/odoo/modules/loading.py", line 556, in reset_modules_state cr.execute( File "/home/borch/odoo/odoo/sql_db.py", line 148, in wrapper return f(self, *args, **kwargs) File "/home/borch/odoo/odoo/sql_db.py", line 225, in execute res = self._obj.execute(query, params)psycopg2.errors.UndefinedTable: relation "ir_module_module" does not existLINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN... ^
2021-07-14 04:46:50,627 6452 CRITICAL borch odoo.service.server: Failed to initialize database `borch`. Traceback (most recent call last): File "/home/borch/odoo/odoo/models.py", line 1128, in _validate_fields check(self) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 343, in _check_xml view_arch = etree.fromstring(view.arch.encode('utf-8')) File "src/lxml/etree.pyx", line 3213, in lxml.etree.fromstring File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument File "src/lxml/parser.pxi", line 1765, in lxml.etree._parseDoc File "src/lxml/parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError File "", line 24lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 24, column 9
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/tools/convert.py", line 758, in parse self._tags[rec.tag](rec, de, mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 663, in _tag_record record = model.with_context(rec_context)._load_records([data], self.mode == 'update') File "/home/borch/odoo/odoo/models.py", line 3910, in _load_records records = self._load_records_create([data['values'] for data in to_create]) File "/home/borch/odoo/odoo/models.py", line 3824, in _load_records_create return self.create(values) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 428, in create return super(View, self).create(vals_list) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/models.py", line 3641, in create fields[0].determine_inverse(batch_recs) File "/home/borch/odoo/odoo/fields.py", line 1200, in determine_inverse getattr(records, self.inverse)() File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch view.write(data) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 445, in write res = super(View, self).write(self._compute_defaults(vals)) File "/home/borch/odoo/odoo/models.py", line 3366, in write self._write(store_vals) File "/home/borch/odoo/odoo/models.py", line 3502, in _write self._validate_fields(vals) File "/home/borch/odoo/odoo/models.py", line 1132, in _validate_fields raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))odoo.exceptions.ValidationError: ('Error while validating constraint\n\nExtra content at the end of the document, line 24, column 9', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/modules/registry.py", line 86, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/borch/odoo/odoo/modules/loading.py", line 360, in load_modules loaded_modules, processed_modules = load_module_graph( File "/home/borch/odoo/odoo/modules/loading.py", line 222, in load_module_graph load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/borch/odoo/odoo/modules/loading.py", line 68, in load_data tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/borch/odoo/odoo/tools/convert.py", line 802, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/borch/odoo/odoo/tools/convert.py", line 865, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 761, in parse pycompat.reraise( File "/home/borch/odoo/odoo/tools/pycompat.py", line 86, in reraise raise value.with_traceback(tb) File "/home/borch/odoo/odoo/tools/convert.py", line 758, in parse self._tags[rec.tag](rec, de, mode=mode) File "/home/borch/odoo/odoo/tools/convert.py", line 663, in _tag_record record = model.with_context(rec_context)._load_records([data], self.mode == 'update') File "/home/borch/odoo/odoo/models.py", line 3910, in _load_records records = self._load_records_create([data['values'] for data in to_create]) File "/home/borch/odoo/odoo/models.py", line 3824, in _load_records_create return self.create(values) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 428, in create return super(View, self).create(vals_list) File "", line 2, in create File "/home/borch/odoo/odoo/api.py", line 462, in _model_create_multi return create(self, arg) File "/home/borch/odoo/odoo/models.py", line 3641, in create fields[0].determine_inverse(batch_recs) File "/home/borch/odoo/odoo/fields.py", line 1200, in determine_inverse getattr(records, self.inverse)() File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch view.write(data) File "/home/borch/odoo/odoo/addons/base/models/ir_ui_view.py", line 445, in write res = super(View, self).write(self._compute_defaults(vals)) File "/home/borch/odoo/odoo/models.py", line 3366, in write self._write(store_vals) File "/home/borch/odoo/odoo/models.py", line 3502, in _write self._validate_fields(vals) File "/home/borch/odoo/odoo/models.py", line 1132, in _validate_fields raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))odoo.tools.convert.ParseError: "Error while validating constraint
Extra content at the end of the document, line 24, column 9None" while parsing /home/borch/odoo/odoo/addons/base/data/ir_demo_data.xml:9, near ir.demo.form ir.demo
  Danger Zone

Demo data should only be used on test databases! Once they are loaded, they cannot be removed!

Please confirm that you want to irreversibly make this database a demo database.



During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/borch/odoo/odoo/service/server.py", line 1164, in preload_registries registry = Registry.new(dbname, update_module=update_module) File "/home/borch/odoo/odoo/modules/registry.py", line 88, in new odoo.modules.reset_modules_state(db_name) File "/home/borch/odoo/odoo/modules/loading.py", line 556, in reset_modules_state cr.execute( File "/home/borch/odoo/odoo/sql_db.py", line 148, in wrapper return f(self, *args, **kwargs) File "/home/borch/odoo/odoo/sql_db.py", line 225, in execute res = self._obj.execute(query, params)psycopg2.errors.UndefinedTable: relation "ir_module_module" does not existLINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN... ^

I have already created the database using the following commands:

$ sudo -u postgres createuser -s $USER
$ createdb $USER

Instructions from here: https://www.odoo.com/documentation/12.0/administration/install.html#id7


I can connect with the database without any issues:
$ psql 

psql (11.12 (Debian 11.12-0+deb10u1))Type "help" for help.
borch=# 

Already installed all requirements. Is there something I am missing? Thanks.


Avatar
Discard
Author

Hi Rajprasad, I recreated the DB and tried to initialize again but I got the same problem:

(.venv) borch@g4560:~/odoo$ dropdb borch

(.venv) borch@g4560:~/odoo$ createdb odoodb

(.venv) borch@g4560:~/odoo$ psql

psql: FATAL: database "borch" does not exist

(.venv) borch@g4560:~/odoo$ psql odoodb

psql (11.12 (Debian 11.12-0+deb10u1))

Type "help" for help.

odoodb=# \l

odoodb=# exit

(.venv) borch@g4560:~/odoo$ python3 odoo-bin --addons-path=addons -d odoodb -i base

es.loading: loading base/data/ir_demo_data.xml

2021-07-14 14:14:19,452 14647 ERROR odoodb odoo.sql_db: bad query: UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')

ERROR: relation "ir_module_module" does not exist

LINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN...

^

2021-07-14 14:14:19,452 14647 ERROR odoodb odoo.modules.registry: Failed to load registry

Best Answer

Hi Jorge,

Try with the below commands:
1) Create a new database:
    createdb #database name
2) Run using python3 instead of python and add newly created db in terminal
    python3 odoo-bin --addons-path=addons  -d #database name -i base

Regards,
RPJ

Avatar
Discard
Best Answer

The working configuration for ODOO14 docker compose is as follows

docker-compose:::

version: '2'
services:
web:
image: odoo:14.0
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
db:
image: postgres:10
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- POSTGRES_DB=odoodb
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
volumes:
odoo-web-data:
odoo-db-data:


odoo.conf in /config folder

[options]
admin_passwd = yoursecret
db_host = db
db_name = odoodb
db_port = 5432
db_user = odoo
db_password = odoo
addons_path = /mnt/extra-addons,/mnt/enterprise
proxy_mode = True
data_dir = /var/lib/odoo

Avatar
Discard