Comment 2 for bug 681463

Revision history for this message
Raphaƫl Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Ujjvala and Bhumika, I'm sorry to announce you that your fix is incorrect.

Instead of removing "template" account from the child_complete_ids list, it removes some "template" accounts but also some normal acounts and leave some other "template" accounts in the list.

Thie bug lies in analytic/analytic.py, in this method:

    def _child_compute(self, cr, uid, ids, name, arg, context=None):
        result = {}
        if context is None:
            context = {}

        for account in self.browse(cr, uid, ids, context=context):
            for child in account.child_ids:
                if child.state == 'template':
                    account.child_ids.pop(account.child_ids.index(child))
            result[account.id] = map(lambda x: x.id, account.child_ids)

That Python code looks rather cryptic to me, so I cannot give details here, but I guess the bug occurs because you are removing elements from the account.child_ids list while you are iterating it at the same time. I believe this doesn't work well in Python.