Hello, Have someone get this error; 'bool' object has no attribute '__getitem__'
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
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.
EDIT:
Try this code for the function:
def get_convertedamount(self, cr,uid,ids,field_name,arg,context=None):
res={}
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):
res={}
if context is None:
context = {}
pchange = self.pool.get('changemanual.change').browse(cr,uid,id,)
res['convertedamount']=pchange['conversionrate']*pchange['amountbeconverted']
return res
_name = 'changemanual.change'
_columns = {
'partner_id': fields.many2one('res.partner','Customer'),
'currency_id'
In this line pchange = self.pool.get('changemanual.change').browse(cr,uid,id,) you call "id" but id is not defined.
Browse objects employ object notation to access attributes. Try
pchange.conversionrate*pchange.amountbeconverted
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.
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
มี.ค. 15
|
10027 |
Hello Francesco, when I try this code, Ihave a keyError. Can you help me?