openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #26922
[Bug 1260245] Re: [V.6.1] project_planning Report fails with key error in orm.py convert_fields
*** This bug is a duplicate of bug 632388 ***
https://bugs.launchpad.net/bugs/632388
** This bug has been marked a duplicate of bug 632388
read : if referenced record is not found,read should bypass
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1260245
Title:
[V.6.1] project_planning Report fails with key error in orm.py
convert_fields
Status in OpenERP Addons (modules):
New
Bug description:
Hi Guys,
I encounter KeyErrors when trying to generate reports for the
projects_planning.
This happens everytime if i create a new database, make several
planning lines in the projects module and have more than one employee
in the planning.
My debugging attempts are the following ( and I quite do not
understand why the code behaves the way if does):
#orm.py line 3545: added some debuging prints
print 'VAL:'
print val
for f in val:
print 'RES:'
print res
res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
for record in res:
print 'current record in res:'
print record
if res2:
print 'RES2 of f='+f+':'
print res2
print 'Record[f]:'
record[f] = res2[record['id']]
print record[f]
print 'NEXT'
else:
record[f] = []
print 'EMPTY'
OUTPUT ON CONSOLE:
VAL:
['groups_id', 'search_view_id', 'display_menu_tip', 'views', 'view_id', 'view_ids']
RES:
[
{
'menu_id': 1,
'context_tz': None,
'context_department_id': None,
'context_lang': u'en_US', 'name': u'Administrator',
'context_section_id': None,
'context_project_id': None,
'company_id': 1,
'menu_tips': False,
'date': '2013-12-12 07:45:20.702872',
'signature': u'Administrator',
'active': True,
'login': u'admin',
'password': u'somepassword',
'id': 1,
'user_email': None,
'action_id': 106
}
]
....
....
....
....does some work successfully
....
....
....
VAL: ['groups_id']
current record in res:
{'menu_id': 1, 'context_tz': None, 'context_department_id': None, 'context_lang': u'en_US', 'name': u'Administrator', 'context_section_id': None, 'context_project_id': None, 'company_id': 1, 'menu_tips': False, 'date': '2013-12-12 07:45:20.702872', 'signature': u'Administrator', 'active': True, 'login': u'admin', 'password': u'somepasword', 'id': 1, 'user_email': None, 'action_id': 106}
RES2 of f=groups_id:
{1: [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]}
Record[f]:
[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
NEXT
current record in res:
{'sum_amount_real': [], 'sum_amount': 12.0, 'account_id': (5, u'I0132 ERP System'), 'id': 12}
RES2 of f=sum_amount_tasks:
{12: 12.0}
Record[f]:
12.0
NEXT
current record in res:
{'sum_amount_real': [], 'sum_amount': 0.0, 'account_id': (5, u'I0132 ERP System'), 'id': 13}
RES2 of f=sum_amount_tasks:
{12: 12.0}
Record[f]:
2013-12-12 08:47:15,089 2045 ERROR ? openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 129, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 195, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 183, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3424, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3559, in _read_flat
record[f] = res2[record['id']]
KeyError: 13
I think this is the table that is worked on here:
select * from report_account_analytic_planning_stat ;
id | user_id | manager_id | account_id | sum_amount | planning_id
----+---------+------------+------------+------------+-------------
17 | 4 | 4 | | 0 | 15
16 | 3 | 4 | | 0 | 15
19 | 4 | 4 | | 0 | 16
18 | 3 | 4 | | 0 | 16
15 | 4 | 4 | | 0 | 14
14 | 3 | 4 | | 0 | 14
13 | 4 | 4 | 5 | 0 | 13
12 | 3 | 4 | 5 | 12 | 13
res2 does not switch the id to id=13 to process the second line of project_planning stat.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1260245/+subscriptions
References