read : if referenced record is not found,read should bypass

Bug #632388 reported by Virgil
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Low
Unassigned

Bug Description

I upgraded from 5.0.12 to 5.0.14 and when I try to access the invoices I get the following error:

Environment Information :
System : Windows-Vista-6.1.7600
OS Name : nt
Operating System Release : Vista
Operating System Version : 6.1.7600
Operating System Architecture : 32bit
Operating System Locale : ro_RO.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.14
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 256, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 577, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 58, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 1387, in fields_view_get
    context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/base/ir/ir_values.py", line 225, in get
    res = filter(bool, map(lambda x: _result_get(x, keys), list(result)))
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/base/ir/ir_values.py", line 225, in <lambda>
    res = filter(bool, map(lambda x: _result_get(x, keys), list(result)))
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/base/ir/ir_values.py", line 211, in _result_get
    datas = self.pool.get(model).read(cr, uid, [id], fields, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 2229, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 2378, in _read_flat
    record[f] = res2[record['id']]
KeyError: 816

Related branches

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

Have you update the base module ? (Administration -> Module -> Base -> Schedule Upgrade)

Revision history for this message
Virgil (virgil-websoftix) wrote :

I just tried to upgrade the base module and in the server log I've got this warning after the operation begin:

[2010-09-07 16:56:08,727][mslab] INFO:init:module base: creating or updating database tables
[2010-09-07 16:56:08,962][mslab] WARNING:orm:[01]: unable to add 'unique(name, module)' constraint on table ir_model_data !
[2010-09-07 16:56:08,962][mslab] WARNING:orm:[02]: If you want to have it, you should update the records and execute manually:
[2010-09-07 16:56:08,962][mslab] WARNING:orm:[03]: ALTER TABLE "ir_model_data" ADD CONSTRAINT "ir_model_data_module_name_uniq" unique(name, module)

The upgrade operation failed at the end but I think is because of a module project_event which I cannot remove anymore from the system.

So, except that warning it seems the base module upgrade is done.

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

And now, if you try to access to invoice, that's work ?

To fix the problem shows by warning message, run the ALTER TABLE "ir_model_data" ADD CONSTRAINT "ir_model_data_module_name_uniq" unique(name, module) SQL command on PostrgreSQL.

Revision history for this message
Virgil (virgil-websoftix) wrote :

No, the invoice still not work and I tried to run the query on PostgreSQL and it fail.
I looked into that table an there are a lot of rows with the same content for name/module pair.

Revision history for this message
Virgil (virgil-websoftix) wrote :

There are tens of lines like those below in the table ir_model_data. It look like for each module there is a line like this.

id;..................;module ; model; res_id; name
3;;"";"";;;"";"";"report_document";"ir.module.module";1;"module_meta_information"
4;;"";"";;;"";"";"mrp_repair";"ir.module.module";2;"module_meta_information"
5;;"";"";;;"";"";"mrp_jit";"ir.module.module";3;"module_meta_information"
6;;"";"";;;"";"";"project_mrp";"ir.module.module";4;"module_meta_information"
7;;"";"";;;"";"";"base_iban";"ir.module.module";5;"module_meta_information"
8;;"";"";;;"";"";"account_voucher";"ir.module.module";6;"module_meta_information"
9;;"";"";;;"";"";"crm_configuration";"ir.module.module";7;"module_meta_information"
10;;"";"";;;"";"";"report_sale";"ir.module.module";8;"module_meta_information"
11;;"";"";;;"";"";"base_module_record";"ir.module.module";9;"module_meta_information"
12;;"";"";;;"";"";"analytic_journal_billing_rate";"ir.module.module";10;"module_meta_information"
13;;"";"";;;"";"";"board_project";"ir.module.module";11;"module_meta_information"
14;;"";"";;;"";"";"board";"ir.module.module";12;"module_meta_information"

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

I haven't this problem when I try to migrate from 5.0.12 to 5.0.14. Please give me the list of installed modules.

Revision history for this message
Virgil (virgil-websoftix) wrote :

I attached the list of installed modules

Revision history for this message
Virgil (virgil-websoftix) wrote :

If it helps, I've done the following test:
I got the code of server and addons from bzr corresponding with the 5.0.12 release and the invoice module work again with the database.

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

In fact, the most simple is to send here your database.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Virgil and Quentin,

This can be a problem while you have removed some xml/db records and the reference of them still exist somewhere.

We will correct it soon.

Thanks.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Virgil,
It has been fixed by revision 2118 <email address hidden>.
Thanks.

@Virgil, if you can trace,it will be useful to you to get rid of this.

Changed in openobject-server:
status: New → Fix Released
importance: Undecided → Low
milestone: none → 5.0.15
summary: - cannot access invoice module after upgrade (5.0.12 to 5.0.14)
+ read : if referenced record is not found,read should bypass
Revision history for this message
Virgil (virgil-websoftix) wrote :

Thank you Jay,

I got the last code and it works now.

How can I trace it? I'm willing to learn to debug, but is not very clear what setup can I use so I can run the server code and step into it to follow an error. I installed PyDev on Eclipse (I'm PHP programmer) but I'm not sure if it's the right path. Any advice will be appreciated.

Anyhow, great to see such fast response and solution, I'm impress.

Thank you very much,
Virgil

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Virgil,

Thanks for the response.

What I meant by debugging is, you will need to go to orm.py file and check which model is calling its read() method and which referred id is not found. This is very technical in context to OpenERP.

The OpenERP team would help you if you can send us the database,through which we would help you pointing out at the root of the problem.

Hope this helps.

Thanks.

Revision history for this message
Ravindra Mekhiya(OpenERP) (rme-openerp) wrote :

Hello Virgil,

We have seen that you might have un-installed any module and there still exists references to 2 reports.

Can you please go to the following menu and remove the records?

Administration/Customization/Actions/Connect Actions To Client Events.
Search reports with name 'factura' and 'invoice infrastat'.
Remove both of them if the value field contains the value 'ir.actions.act_window,806' or 'ir.actions.act_window,816'.

We tried it here and it worked smoothly.

Good luck.
Thanks.

Revision history for this message
Virgil (virgil-websoftix) wrote :

Hello RME,

Yes, it works for me also.

Thank you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.