Using migrate.py and debugging messages [6.1-7.0]

Asked by Alexandro Colorado

Thanks Holger, can you let me know the steps to make it work, should I just drop it on the legacy OE, the new OE, is there a config argument I should also include.

ATM I have something like this:
/home/user/public_html/openerp6/
/home/user/public_html/openerp7/
/home/user/public_html/openupgrade-server/
/home/user/public_html/openupgrade-addons/

I have the default database (sample database) with 6 common standard modules (crm, sales, purchase, projects, hr, accounting).

I download the script, I tried to run it as the following:
python migrate.py -C openerp6/install/openerp-server.conf --run-migrations="7.0" --branch-dir=/home/user/tmp/openupgrade

had to add the db_name=name to the openerp-server.conf on 6.x

As it ran it connect to the bzr repo and re-download the openerp-web/7.0

[update]
I ran the script and got the following errors on the stout:
http://pastebin.mozilla.org/3765418

OpenERP 7 seemed to have adopted the new database (it now has the one one on 6) but when I tried to login I got the following error:
http://pastebin.mozilla.org/3765405
OpenERP Server Error

Client Traceback (most recent call last):
  File "/home/jza/public_html/openerp7/openerp/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/home/jza/public_html/openerp7/openerp/addons/web/controllers/main.py", line 867, in authenticate
    req.session.authenticate(db, login, password, env)
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 118, in authenticate
    if uid: self.get_context()
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 170, in get_context
    self.context = self.model('res.users').context_get() or {}
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 42, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last):
  File "/home/jza/public_html/openerp7/openerp/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/jza/public_html/openerp7/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/jza/public_html/openerp7/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/jza/public_html/openerp7/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/jza/public_html/openerp7/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jza/public_html/openerp7/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/jza/public_html/openerp7/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/jza/public_html/openerp7/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/home/jza/public_html/openerp7/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/home/jza/public_html/openerp7/openerp/addons/base/res/res_users.py", line 363, in context_get
    res = getattr(user,k) or False
  File "/home/jza/public_html/openerp7/openerp/osv/orm.py", line 494, in __getattr__
    return self[name]
  File "/home/jza/public_html/openerp7/openerp/osv/orm.py", line 402, in __getitem__
    field_values = self._table.read(self._cr, self._uid, ids, field_names, context=self._context, load="_classic_write")
  File "/home/jza/public_html/openerp7/openerp/addons/base/res/res_users.py", line 810, in read
    res = super(users_view, self).read(cr, uid, ids, fields, context=context, load=load)
  File "/home/jza/public_html/openerp7/openerp/addons/base/res/res_users.py", line 272, in read
    result = super(res_users, self).read(cr, uid, ids, fields=fields, context=context, load=load)
  File "/home/jza/public_html/openerp7/openerp/osv/orm.py", line 3620, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/jza/public_html/openerp7/openerp/osv/orm.py", line 3672, in _read_flat
    cr.execute(query, [tuple(sub_ids)] + rule_params)
  File "/home/jza/public_html/openerp7/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/home/jza/public_html/openerp7/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column res_users.alias_id does not exist
LINE 1: SELECT res_users."menu_id",res_users."alias_id",res_users."a...

Question information

Language:
English Edit question
Status:
Solved
For:
OpenUpgrade Server Edit question
Assignee:
No assignee Edit question
Solved by:
Alexandro Colorado
Solved:
Last query:
Last reply:
Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#1

you wouldn't have to download anything besides the script, it does that for you. But there's no problem with the way you did it either.

Now the scripts gives two errors which seem to be fatal, and the error log you post shows that the migration stopped in a very early stage if it ran at all.

The script writes the error log to $branch-dir/migration.log, could you post that one please?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#2

Alexandro, thanks for creating a new issue!

The stdout of the database restore shows severe problems

The first error seems to be key:

pg_restore: [archiver (db)] COPY failed for table "res_currency": ERROR: value too long for type character varying(3)
CONTEXT: COPY res_currency, line 27, column symbol: "лв"

Looks like your template1 database is not UTF-8. Apparently, the script does not enforce this either. Try adding WITH ENCODING 'UTF8' to the query in line 192 of migrate.py.

Revision history for this message
Alexandro Colorado (jzarecta) said :
#3

@Holger: hi, this is the migration.log content:
http://pastebin.mozilla.org/3769266

@Stefan:
I see, I have added the 'With encoding 'utf8', template1 was created as SQL_ASCII instead of UTF8 even thought the 6.1 db is UTF8 will report back on this.

Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#4

the log you just posted also points to encoding problems, so keep us updated if Stefan's suggestion solves the problem

Revision history for this message
Alexandro Colorado (jzarecta) said :
#5

I was able to get the script running now I am presented with the following path:
/home/user/tmp/openupgrade/7.0/
 ...server/scripts/
 ...web/
 ...addons/
 ...server.cfg

I ran the server/openerp-server --xmlrpc-port=1800 and showed some errors:

ImportError: No module named web
2013-12-13 17:11:35,329 20656 WARNING ? openerp.modules.module: module web: module not found
2013-12-13 17:11:35,331 20656 CRITICAL ? openerp.modules.module: Couldn't load module web
2013-12-13 17:11:35,331 20656 CRITICAL ? openerp.modules.module: No module named web
2013-12-13 17:11:35,331 20656 ERROR ? openerp.service: Failed to load server-wide module `web`.
The `web` module is provided by the addons found in the `openerp-web` project.
Maybe you forgot to add those addons in your addons_path configuration.

Here is the second error:
ImportError: No module named web
2013-12-13 17:11:35,332 20656 WARNING ? openerp.modules.module: module web_kanban: module not found
2013-12-13 17:11:35,333 20656 CRITICAL ? openerp.modules.module: Couldn't load module web_kanban
2013-12-13 17:11:35,333 20656 CRITICAL ? openerp.modules.module: No module named web_kanban
2013-12-13 17:11:35,334 20656 ERROR ? openerp.service: Failed to load server-wide module `web_kanban`.

Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#6

so you ran migrate.py, it didn't show any errors and now you try to run openerp afterwards?

if this is the case, you're done already. Consider everything he created in tmp/openupgrade as temporary files. just run your regular 7.0 installation and use the _migrated version of your database.

Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#7

...if there were any issues, they should have been logged in migration.log, so please keep that file and post it in case of further questions

Revision history for this message
Alexandro Colorado (jzarecta) said :
#8

I did experience many errors:

2013-12-13 19:16:22,044 26645 ERROR prueba1 openerp.modules.graph: module sale_crm: Unmet dependencies: crm
2013-12-13 19:16:22,044 26645 ERROR prueba1 openerp.modules.graph: module project: Unmet dependencies: base_status
2013-12-13 19:16:22,044 26645 ERROR prueba1 openerp.modules.graph: module sale_mrp: Unmet dependencies: sale_stock
2013-12-13 19:16:22,048 26645 ERROR prueba1 openerp.modules.graph: module base_calendar: Unmet dependencies: base_status
2013-12-13 19:16:22,049 26645 ERROR prueba1 openerp.modules.graph: module crm: Unmet dependencies: base_status, base_calendar

and some warning:

2013-12-13 19:16:21,858 26645 WARNING prueba1 openerp.modules.module: module base_tools: module not found
2013-12-13 19:16:21,869 26645 WARNING prueba1 openerp.modules.module: module base_tools: module not found
2013-12-13 19:16:21,869 26645 WARNING prueba1 openerp.modules.module: module base_tools: module not found
2013-12-13 19:16:21,870 26645 WARNING prueba1 openerp.modules.graph: module base_tools: not installable, skipped
2013-12-13 19:16:21,890 26645 WARNING prueba1 openerp.modules.module: module web_process: module not found
2013-12-13 19:16:21,894 26645 WARNING prueba1 openerp.modules.module: module web_process: module not found
2013-12-13 19:16:21,895 26645 WARNING prueba1 openerp.modules.module: module web_process: module not found
2013-12-13 19:16:21,899 26645 WARNING prueba1 openerp.modules.graph: module web_process: not installable, skipped
2013-12-13 19:16:21,935 26645 WARNING prueba1 openerp.modules.module: module web_mobile: module not found
2013-12-13 19:16:21,936 26645 WARNING prueba1 openerp.modules.module: module web_mobile: module not found
2013-12-13 19:16:21,936 26645 WARNING prueba1 openerp.modules.module: module web_mobile: module not found
2013-12-13 19:16:21,936 26645 WARNING prueba1 openerp.modules.graph: module web_mobile: not installable, skipped
2013-12-13 19:16:21,985 26645 WARNING prueba1 openerp.modules.module: module fetchmail_crm: module not found
2013-12-13 19:16:21,986 26645 WARNING prueba1 openerp.modules.module: module fetchmail_crm: module not found
2013-12-13 19:16:21,987 26645 WARNING prueba1 openerp.modules.module: module fetchmail_crm: module not found
2013-12-13 19:16:21,987 26645 WARNING prueba1 openerp.modules.graph: module fetchmail_crm: not installable, skipped
2013-12-13 19:16:21,987 26645 WARNING prueba1 openerp.modules.module: module web_dashboard: module not found
2013-12-13 19:16:21,989 26645 WARNING prueba1 openerp.modules.module: module web_dashboard: module not found
2013-12-13 19:16:21,995 26645 WARNING prueba1 openerp.modules.module: module web_dashboard: module not found
2013-12-13 19:16:21,996 26645 WARNING prueba1 openerp.modules.graph: module web_dashboard: not installable, skipped

The migration.log got quite large, but I paste many of the messages in it.
http://pastebin.mozilla.org/3770192

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#9

No, that did not go well. I gather from your last comment that this is not the complete log, is it? We do need that to say something more.

Revision history for this message
Alexandro Colorado (jzarecta) said :
#10
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#11

  File "base/migrations/7.0.1.3/pre-migration.py", line 155, in create_users_partner
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)

So more encoding woes. Not sure which revision you're on, but that method only contains database cursor interactions. As OpenERP sets psycopg2.extensions.UNICODE, this should not happen on a system with correctly configured encodings. You should check all of that.

Revision history for this message
Alexandro Colorado (jzarecta) said :
#13

where can I look around for 'ascii' type encoding, from the postgresql channel they told me to check the content of the variables from the database. I can see that the errors were not only on res_users but also many other tables were affected, however the final daatabase do show the same ammount of data on both res_user table and res_partner.

Can you help me trying to see which data is causing the errors?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#14

Look at "base/migrations/7.0.1.3/pre-migration.py", line 155. My guess is that this is where partner names are selected. The 'offensive' data is probably partners with diacritics in their names, such as 'éàü'.

Just curious: have you ever worked with a backup copy of your database? Did you experience anything like this?

Revision history for this message
Alexandro Colorado (jzarecta) said :
#15

Tried a new database, and this time this gave me a different output.
http://pastebin.mozilla.org/3794692

I didnt had any error regarding encoding this time, however some more mild errors, but I stil have no idea how to go about them. I assume that the TZ filed was the one defined at the configuration, and not setting it up made the migration script somewhat confused. At least that's what I think it happened.

The modules that were affected the most were:
res.company = * res.company.form.inherit
res.users = * res.users.form

All the errors complain about not being able to find:
context_tz, menu_tips, context_lang
and from res.company, the field property_reserve_and_surplus_account and security_lead

Revision history for this message
Alexandro Colorado (jzarecta) said :
#16

@Stefan
Thanks,
Seems the UTF8 issues are solved, but I am still experiencing difficulties, this time look more migration-proper issue, regarding the res.users/company. I've heard there were changes to the layout of these fields between 6.1 and 7.0.

The script seems to have coughed them out and I am still not able to login on the 7.0 without experriencing the same issue I paste on comment.

ProgrammingError: column res_users.alias_id does not exist
LINE 1: ...CT res_users."menu_id",res_users."gmail_password",res_users....

Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#17

Hi Alexandro,

the errors about missing fields in views are expected, so that's okay.

Your log from december 17th looks okay so far, but it stops in the middle at line 522. Any chance you could upload the complete log?

Further just to be sure: You do your login on database astro_migrated and not the original one, right?

Could you verify with
psql astro_migrated
\d res_users
that the alias_id column is created after the migration?

Revision history for this message
Alexandro Colorado (jzarecta) said :
#18

hi I think I am out of the woods with this, but still have issues on a post-migration level now. BTW the issue was that the migration was not even generating the data information on the migrated table. Mainly because the binary was failing to import back into the postgresql.

At the moment it seems some of the models are just having issues on the new platform. Another issue I found is on the views, for example I am unable to watch my invoices (on accounting -> client/partners -> invoices). The form view throws an XML Attribute error:
AttributeError: View definition error for inherited view 'account_invoice_layout.account_invoice_form_inherit_1' on model 'account.invoice': Element '<xpath expr="/form/notebook/page/field[@name='invoice_line']">' not found in parent view 'account.invoice_form'

Mainly the accounting.invoice depends on a parent view: http://pastebin.mozilla.org/3917962 and an inherit view http://pastebin.mozilla.org/3917794

I access the views on Settings -> Technical -> User Interface -> Views -> account.invoice.form / account_invoice_layout.account_invoice_form_inherit_1
Here is a screenshot: http://imagebin.org/284799

The error seems to happen around line 53 of the account.invoice.form.

Revision history for this message
Holger Brunn (Therp) (hbrunn) said :
#19

good to hear. So I conclude your problems were caused by some database setup issues? If you feel that those are problems other people might run into too, it would be great if you could do a summary of what went wrong and how you fixed it.

account_invoice_layout is not supported in version 7.0 any more, so you'll have to deinstall this module (or port it to version 7.0): http://v6.openerp.com/node/1269#h.k5rq39nvqtb4

Revision history for this message
Alexandro Colorado (jzarecta) said :
#20

Oh thank you for telling me. I have been trying to fix this for a few days now and I was going a bit crazy trying to solve it. I had similar issues with other modules like web mobile addon which also has been deprecated in version 7.0.

So my only issue here is how to finalize the migration. Meaning, after I uninstall the account_invoice_layout, how will the client be able to pull out his invoices (under Accounting -> Client -> Client Invoice).

Will uninstalling this and run an update would be all that is needed or should I install something on its place manually?

Regards, and Happy new year.

Revision history for this message
Alexandro Colorado (jzarecta) said :
#21

Wow, I went ahead an uninstalled the module account_invoice_layout and now I am presented with the following, more serious bug report:

" File "/home/ubuntu/openerp7/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/ubuntu/openerp7/openerp/osv/orm.py", line 3623, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/ubuntu/openerp7/openerp/osv/orm.py", line 3744, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
  File "/home/ubuntu/openerp7/openerp/osv/fields.py", line 538, in get
    ids2 = obj.pool.get(self._obj).search(cr, user, domain + [(self._fields_id, 'in', ids)], limit=self._limit, context=context)
  File "/home/ubuntu/openerp7/openerp/osv/orm.py", line 2369, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/home/ubuntu/openerp7/openerp/osv/orm.py", line 4887, in _search
    cr.execute('SELECT "%s".id FROM ' % self._table + from_clause + where_str + order_by + limit_str + offset_str, where_clause_params)
  File "/home/ubuntu/openerp7/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/home/ubuntu/openerp7/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column account_invoice_line.sequence does not exist
LINE 1: ...ORDER BY "account_invoice_line__invoice_id"."id" ,"account_i..."

Seems this is the only most important issue I am having to get the 7.0 operational. Please help.

Revision history for this message
Alexandro Colorado (jzarecta) said :
#22

after perfoming another --update all, the table was updated and I can see the client invoices. Sorry for the overreaction. I am closing this ticket.

Regards.