Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GabbasovDinar/f34b4111b351a9f0d20a1996e3cc974c to your computer and use it in GitHub Desktop.
Save GabbasovDinar/f34b4111b351a9f0d20a1996e3cc974c to your computer and use it in GitHub Desktop.
- Разверните дамп продакшен базы у себя локально и сбросьте пароль с почтовыми серверами
- Переключите все репозитории git в 12.0 ветку
- Удалите все docker image проекта
- Clone OpenUpgrade Project
- Add the OpenUpgrade instead Odoo and add filestore
- Build new Odoo image
- Change Dockerfile:
```
RUN apt-get update && apt-get install git -y
RUN pip install git+git://github.com/OCA/openupgradelib.git
```
- run docker compose with keys ```-u all --stop-after-init``
- fix errors and run docker compose again
Ошибка 1:
2020-04-13 10:52:46,210 1 ERROR db_odoo odoo.sql_db: bad query: b'CREATE UNIQUE INDEX "ir_translation_unique" ON "ir_translation" (type, name, lang, res_id, md5(src))'
ERROR: could not create unique index "ir_translation_unique"
DETAIL: Key (type, name, lang, res_id, md5(src))=(model, ir.model.fields,field_description, ru_RU, 3118, 9aa111838755c8ea992df65822730f73) is duplicated.
2020-04-13 10:52:46,212 1 WARNING db_odoo odoo.modules.loading: Transient module states were reset
2020-04-13 10:52:46,212 1 ERROR db_odoo odoo.modules.registry: Failed to load registry
Решение 1:
в 11-ой версии обновил базу получил ошибку при обновлении модуля website в view поставил active=False чтоб этот вид не обновлялся
после обновления всех модулей переключиться на 12-ую версию вместе и заменить filestore из ветки 11
затем еще раз запустить миграцию
Ошибка 2:
File "/odoo/src/odoo/addons/base/models/res_users.py", line 940, in write
self._check_one_user_type()
File "/odoo/src/odoo/addons/base/models/res_users.py", line 113, in _check_one_user_type
self.mapped('users')._check_one_user_type()
File "/odoo/src/odoo/addons/base/models/res_users.py", line 405, in _check_one_user_type
raise ValidationError(_('The user cannot have more than one user types.'))
odoo.exceptions.ValidationError: ('Пользователь не может иметь больше, чем один тип пользователя.', None)
Решение 2:
Значит пользователь состоит в двух группах одного типа, надо выяснить какой пользователь и в каких группах состоит
_check_one_user_type если посмотреть этот метод там написано в докстрингах в чем может быть проблема
надо выполнить
query = """
SELECT r.uid
FROM res_groups_users_rel r
WHERE r.gid IN %s""" + where_clause + """
GROUP BY r.uid HAVING COUNT(r.gid) > 1
"""
вместое оригинального метода и посмотреть у каких именно пользователей есть лишние группы
db_odoo=# delete from res_groups_users_rel where gid=9 and uid=90;
DELETE 1
db_odoo=# delete from res_groups_users_rel where gid=9 and uid=86;
DELETE 1
Ошибка 3:
2020-04-13 13:45:16,484 1 INFO db_odoo odoo.modules.loading: loading l10n_de/data/res.country.state.csv
2020-04-13 13:45:16,514 1 ERROR db_odoo odoo.sql_db: bad query: INSERT INTO "res_country_state" ("id", "create_uid", "create_date", "write_uid", "write_date", "code", "country_id", "name") VALUES (nextval('res_country_state_id_seq'), 1, (now() at time zone 'UTC'), 1, (now() at time zone 'UTC'), 'HE', 57, 'Hessen') RETURNING id
ERROR: duplicate key value violates unique constraint "res_country_state_name_code_uniq"
DETAIL: Key (country_id, code)=(57, HE) already exists.
2020-04-13 13:45:16,528 1 ERROR db_odoo odoo.sql_db: bad query: INSERT INTO "res_country_state" ("id", "create_uid", "create_date", "write_uid", "write_date", "code", "country_id", "name") VALUES (nextval('res_country_state_id_seq'), 1, (now() at time zone 'UTC'), 1, (now() at time zone 'UTC'), 'HE', 57, 'Hessen') RETURNING id
ERROR: duplicate key value violates unique constraint "res_country_state_name_code_uniq"
DETAIL: Key (country_id, code)=(57, HE) already exists.
Решение 3:
убрать из модуля l10n_de/data/res.country.state.csv:
state_de_sn,base.de,"Sachsen","SN"
state_de_he,base.de,"Hessen","HE"
потом обновил через -u all все работает
После успешной миграции необходимой необходимо запустить Odoo 12 с новой базой
Получаем ошибку:
2020-04-13 14:12:02,976 1 ERROR db_odoo odoo.addons.website.models.ir_http: 500 Internal Server Error:
Traceback (most recent call last):
File "/odoo/src/odoo/addons/base/models/qweb.py", line 347, in _compiled_fn
return compiled(self, append, new, options, log)
File "<template>", line 1, in template_179_5
File "<template>", line 2, in body_call_content_4
AttributeError: 'website' object has no attribute 'get_bgimage'
нужно удалить шаблон clarico_signin_c_signin через psql
но сначало надо установить и обновить новые модули
из 11-ой версии выгрузили список установленных модулей и через -u запустили на 12-ой версии
удалить все qweb шаблоны связанных с кларико:
ALTER table ir_ui_view drop constraint ir_ui_view_inherit_id_fkey;
ALTER table ir_ui_view add constraint ir_ui_view_inherit_id_fkey FOREIGN KEY (inherit_id) REFERENCES ir_ui_view(id) ON DELETE CASCADE;
delete from ir_ui_view where type='qweb' and key ilike '%clarico%';
удалить модули которые мешаю прогрузиться странице login:
update ir_module_module set state='to remove' where name = 'website_forum_doc';
update ir_module_module set state='to remove' where name ilike 'snippet_style_%';
update ir_module_module set state='to remove' where name='customize_theme';
перезапустить сервер -u website
- remove modules if needed https://stackoverflow.com/questions/21485630/how-to-uninstall-manually-openerp-module/41760541#41760541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment