Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules update problems after upgrade to v10 #1838

Closed
sebastienhasa opened this issue May 17, 2019 · 13 comments
Closed

modules update problems after upgrade to v10 #1838

sebastienhasa opened this issue May 17, 2019 · 13 comments

Comments

@sebastienhasa
Copy link

I've done a migration from Odoo v9 to v10 using OpenUpgrade.
Openupgrade finish without problem but when I import the migrated
database to an Odoo v10 and upgrade the modules, I got this error:

 2019-05-17 12:43:12,382 22 ERROR byrd_test werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 186, in application
    return application_unproxied(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 172, in application_unproxied
    result = handler(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1326, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1300, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1482, in dispatch
    odoo.registry(db).check_signaling()
  File "/usr/lib/python2.7/dist-packages/odoo/__init__.py", line 52, in registry
    return modules.registry.Registry(database_name)
  File "/usr/lib/python2.7/dist-packages/odoo/modules/registry.py", line 59, in __new__
    return cls.new(db_name)
  File "/usr/lib/python2.7/dist-packages/odoo/modules/registry.py", line 83, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/odoo/modules/loading.py", line 318, in load_modules
    report=report, models_to_check=models_to_check)
  File "/usr/lib/python2.7/dist-packages/odoo/modules/loading.py", line 182, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/usr/lib/python2.7/dist-packages/odoo/modules/loading.py", line 96, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python2.7/dist-packages/odoo/tools/convert.py", line 839, in convert_file
    convert_csv_import(cr, module, pathname, fp.read(), idref, mode, noupdate)
  File "/usr/lib/python2.7/dist-packages/odoo/tools/convert.py", line 895, in convert_csv_import
    raise Exception(_('Module loading %s failed: file %s could not be processed:\n %s') % (module, fname, warning_msg))
Exception: Impossible de charger le module base : le fichier base/res/res.lang.csv n'a pas pu \xeatre trait\xe9 :
duplicate key value violates unique constraint "res_lang_code_uniq"
DETAIL:  Key (code)=(fr_CH) already exists.

duplicate key value violates unique constraint "res_lang_name_key"
DETAIL:  Key (name)=(German / Deutsch) already exists.

The base module is marked as supported here:
#757
So, I was thinking this would work.

After some inspection on the res_lang database, I see that its id
field is an Integer, when in the csv file it's a String. Did something
go wrong on my upgrade?

@pedrobaeza
Copy link
Member

This is because you have a duplicated language fr_CH. It can be because the original one was deleted and thus the new one doesn't have the associated XML-ID.

Any way, not OpenUpgrade issue itself, but on your data.

@sebastienhasa
Copy link
Author

Any way, not OpenUpgrade issue itself, but on your data.

Data upgraded by OpenUpgrade. OpenUpgrade should transform database to
not block future module upgrade.

This is because you have a duplicated language fr_CH

No, this is because, when updated, the base module load a long list of
languages in res.lang, and the table already store the installed
languages. Originally, my database had some languages installed like
swiss french and german. Actually, res_lang has only 3 entries:

  • German
  • Swiss French
  • English

No publication.

As understand it: res_lang store installed language in Odoo <= 9 and
store languages known by Odoo in versions >= 10. When I upgrade the
base module, Odoo fail to load known language because res_lang contain
language previously installed. And this should not append because
OpenUpgrade should adapt the table to correspond to the new usage.

Upgrading a full working database with OpenUpgrade should not made it
not working. And if it's happend, it not come from the data but from
what transform, or not transform, it.

@pedrobaeza
Copy link
Member

OpenUpgrade should transform database to not block future module upgrade.

Sorry, but no. If you have screwed up your data, it's your duty to fix them. The long list is there since the beginning, and if you keep the proper XML-IDs linked to those records, they are updated, not created again.

@sebastienhasa
Copy link
Author

Sorry, but no. If you have screwed up your data, it's your duty to fix them.

I didn't screwed up my data: The database work in Odoo v9. The only thing I do was running OpenUpgrade.

@pedrobaeza
Copy link
Member

With that attitude what you are going to get is my denial of even answering you.

I'm guessing you added manually the language in v9 instead of activating it through "Load translation" wizard. Could that be that way?

@pedrobaeza
Copy link
Member

pedrobaeza commented May 17, 2019

FYI, this is the code where this is handled here in OpenUpgrade:

cr.execute(
'''insert into ir_model_data
(module, name, model, res_id)
select
'base',
'lang_' ||
case
when char_length(code) > 2 then
case
when upper(substring(code from 1 for 2)) =
upper(substring(code from 4 for 2)) then
substring(code from 1 for 2)
else
code
end
else
code
end,
'res.lang', id
from res_lang''')

@sebastienhasa
Copy link
Author

I'm guessing you added manually the language in v9 instead of activating it through "Load translation" wizard. Could that be that way?

The language was added long time ago in an Odoo v7, but it wasn't by
me. So I don't know how these languages was added. I migrated the
database from 7 to 8, then from 8 to 9. Each time I imported the
database to a new installation of Odoo and restart it with the option
--update=all to update all modules. I got some problems with some
not used modules and uninstall themes, but it was never about language
support.

If I look at the database after the migration from Odoo 9 to 10, I see
that I got only one xml_id for the languages: The xml_id for English.

Is it possible that these missing xml_id come from the older version
of Odoo my database come from? How is it possible to wrongly add a
language and resulting of languages and translations that doesn't have
an xml_id?

PS: Open a mailling list for this kind of situation would
help to filter bug from weird old databases problems

@pedrobaeza
Copy link
Member

XML-IDs are created on the fly in this case in the piece of code that I have pointed below, and it's prepared for handling regional variations. Did the language in <v10 have a proper code informed?

@pedrobaeza
Copy link
Member

Execute the select part of that SQL in v9 DB and put the result here.

@sebastienhasa
Copy link
Author

sebastienhasa commented May 17, 2019

Execute the select part of that SQL in v9 DB and put the result here.

INSERT 0 3

select id, name, module, model, res_id from ir_model_data where model='res.lang';
  id   |    name    | module |  model   | res_id 
-------+------------+--------+----------+--------
   963 | lang_en    | base   | res.lang |      1
 21385 | lang_de    | base   | res.lang |      3
 21386 | lang_fr_CH | base   | res.lang |      2
 21387 | lang_en_US | base   | res.lang |      1
(4 rows)

It's strange that after upgrade from v9 to v10 theses xml_id wasn't created. I didn't see anything in the migration log about this.

@pedrobaeza
Copy link
Member

Well, this should match then with the new entry:

https://github.com/OCA/OpenUpgrade/blob/10.0/odoo/addons/base/res/res.lang.csv#L23

and don't give any conflict, so now you have all the hints for investigating the problem.

@sebastienhasa
Copy link
Author

so now you have all the hints for investigating the problem

Yep. Thank. I will investigate after my return of holiday 😃

@parchanco
Copy link

@sebastienhasa got this problem after a migration. Do you remember what did you do to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants