Odoo Help


'bool' object has no attribute '__getitem__'

on 8/29/13, 1:08 PM 9,401 views

Hello, Have someone get this error; 'bool' object has no attribute '__getitem__'

Hello Francesco, when I try this code, Ihave a keyError. Can you help me?

on 9/5/13, 2:59 PM

Francesco OpenCode

--Francesco OpenCode--
Francesco OpenCode
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 8/29/13, 1:14 PM

This is a classic error you obtain when are you reference your pool.get to a class that doesn't exist. Read your code and search the error or post the code and we can help you.


Try this code for the function:

def get_convertedamount(self, cr,uid,ids,field_name,arg,context=None):
     for pchange in self..browse(cr,uid,ids):
         res[pchange.id].update({'convertedamount' : pchange.conversionrate * pchange[.amountbeconverted})
     return res

Hello Francesco, thank you for your answer

this is my code:

class changemanual_change(osv.osv):

def get_convertedamount(self, cr,uid,ids,field_name,arg,context=None):
     if context is None:
         context = {}
     pchange = self.pool.get('changemanual.change').browse(cr,uid,id,)

     return res

_name = 'changemanual.change'    
_columns = {
    'partner_id': fields.many2one('res.partner','Customer'),
on 8/29/13, 1:22 PM

In this line pchange = self.pool.get('changemanual.change').browse(cr,uid,id,) you call "id" but id is not defined.

Francesco OpenCode
on 8/29/13, 2:17 PM
On 8/29/13, 2:20 PM

Browse objects employ object notation to access attributes. Try


Also I advise conditional test for existence of value.

if pchange.conversionrate and pchange.amountbeconverted:
    res['convertedamount'] = pchange.conversionrate*pchange.amountbeconverted

Otherwise you have typeerror when ORM returns False.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 8/29/13, 1:08 PM
Seen: 9401 times
Last updated: 3/16/15, 8:10 AM