Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3428 Lượt xem

I've encountered a problem on Odoo 11 CE wherein website builder module fails to be reinstalled after uninstalling it. Please help me to reinstall it. More details of the problem are as follows.

A prompt says:

Odoo Server Error - Validation Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: website - website]


Here is a copy of the logs:

2019-04-29 04:13:34,542 2024 INFO C4L werkzeug: 127.0.0.1 - - [29/Apr/2019 04:13:34] "POST /longpolling/poll HTTP/1.1" 200 -
2019-04-29 04:13:36,751 2024 INFO C4L odoo.addons.base.module.module: ALLOW access to module.button_immediate_install on ['website'] to user michael.ayapana@care4lifetrading.com #1 via 127.0.0.1
2019-04-29 04:13:36,752 2024 INFO C4L odoo.addons.base.module.module: User #1 triggered module installation
2019-04-29 04:13:36,752 2024 INFO C4L odoo.addons.base.module.module: ALLOW access to module.button_install on ['website'] to user michael.ayapana@care4lifetrading.com #1 via 127.0.0.1
2019-04-29 04:13:36,988 2024 INFO C4L odoo.modules.loading: loading 1 modules...
2019-04-29 04:13:37,014 2024 INFO C4L odoo.modules.loading: 1 modules loaded in 0.03s, 0 queries
2019-04-29 04:13:37,229 2024 INFO C4L odoo.modules.loading: updating modules list
2019-04-29 04:13:37,230 2024 INFO C4L odoo.addons.base.module.module: ALLOW access to module.update_list on [] to user michael.ayapana@care4lifetrading.com #1 via 127.0.0.1
2019-04-29 04:13:37,953 2024 INFO C4L odoo.modules.loading: loading 55 modules...
2019-04-29 04:13:38,069 2024 INFO C4L odoo.modules.loading: 55 modules loaded in 0.12s, 0 queries
2019-04-29 04:13:38,077 2024 INFO C4L odoo.modules.loading: loading 59 modules...
2019-04-29 04:13:38,428 2024 INFO C4L odoo.modules.registry: module website: creating or updating database tables
2019-04-29 04:13:38,795 2024 INFO C4L odoo.models: Computing parent left and right for table website_menu...
2019-04-29 04:13:39,028 2024 INFO C4L odoo.addons.auth_crypt.models.res_users: Hashing passwords, may be slow for databases with many users...
2019-04-29 04:13:39,244 2024 INFO C4L odoo.models: Storing computed values of website.default_lang_code
2019-04-29 04:13:39,591 2024 ERROR C4L odoo.sql_db: bad query: b'ALTER TABLE "ir_ui_view" ADD FOREIGN KEY ("website_id") REFERENCES "website"("id") ON DELETE cascade'
ERROR: insert or update on table "ir_ui_view" violates foreign key constraint "ir_ui_view_website_id_fkey"
DETAIL:  Key (website_id)=(1) is not present in table "website".

2019-04-29 04:13:39,593 2024 WARNING C4L odoo.modules.loading: Transient module states were reset
2019-04-29 04:13:39,593 2024 ERROR C4L odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 380, in load_modules
    loaded_modules, update_module, models_to_check)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 274, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 153, in load_module_graph
    registry.init_models(cr, model_names, {'module': package.name})
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 311, in init_models
    func()
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\fields.py", line 1957, in update_db_foreign_key
    new = process(model._cr, model._table, self.name, comodel._table, 'id', self.ondelete or 'set null')
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\sql.py", line 177, in fix_foreign_key
    return add_foreign_key(cr, tablename1, columnname1, tablename2, columnname2, ondelete)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\sql.py", line 150, in add_foreign_key
    cr.execute(query.format(tablename1, columnname1, tablename2, columnname2, ondelete))
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\sql_db.py", line 232, in execute
    res = self._obj.execute(query, params)
psycopg2.IntegrityError: insert or update on table "ir_ui_view" violates foreign key constraint "ir_ui_view_website_id_fkey"
DETAIL:  Key (website_id)=(1) is not present in table "website".

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

HI,

This is already fixed in Odoo11, refer this this issue posted in odoo github repositiry: https://github.com/odoo/odoo/issues/25078 and which is already fixed by this commit: https://github.com/odoo/odoo/commit/21a95bae505d5589c4f5801e4c24681418b99e16 .


So get the latest code of the odoo11 and check still issue there or not

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

EDIT: I managed to reinstall the website module with the help of Swapnesh. What he did was he deleted the website_id column of ir_ui_view table and added the base.default_user record on website_data.xml under Odoo 11.0\server\odoo\addons\website\data. Thanks everyone.


Hi Odoo Mates,

I am using Odoo in Windows. I've tried uninstalling Odoo 11 and reinstalling it using the recently downloaded Odoo 11 installer from Odoo website. But when I tried to install the Website builder, same error is still shown. I am thinking that if I install website builder and reinstall it again on a freshly installed latest Odoo 11, problem wont show up. But since I already uninstalled the website builder on old Odoo 11 code, I think this is the reason why I still have the error. Do you have an idea on how could I reinstall Website builder? Perhaps I could edit some data on postgre database?

Ảnh đại diện
Huỷ bỏ