-
  We retrieve all accounts and test that those are in a tree data structure.
- 
  !python {model: account.account}: |
    ids = self.search(cr, uid, [])
    accounts_list = self.read(cr, uid, ids, ['parent_id','parent_left','parent_right'])
    accounts = dict((x['id'], x) for x in accounts_list)
    log("Testing parent structure for %d accounts", len(accounts_list))
    for a in accounts_list:
        if a['parent_id']:
            assert a['parent_left'] > accounts[a['parent_id'][0]]['parent_left']
            assert a['parent_right'] < accounts[a['parent_id'][0]]['parent_right']
        assert a['parent_left'] < a['parent_right']
        for a2 in accounts_list:
            assert not ((a2['parent_right'] > a['parent_left']) and 
                (a2['parent_left'] < a['parent_left']) and 
                (a2['parent_right'] < a['parent_right']))
            if a2['parent_id']==a['id']:
                assert (a2['parent_left'] > a['parent_left']) and (a2['parent_right'] < a['parent_right'])

