Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7803 Lượt xem

I am creating a module called obp_client where I have defined a Bank model object. The code for the Bank model is written in the obp_client/obp_client.py file.

I get this error when trying to install the module:

AttributeError: 'Bank' object has no attribute 'pool'

The error is encountered in the following line according to the traceback [1] But I am not able to figure out whats wrong with the command? (I am pretty sure that there is no problem in the accessing attributes of item, its something to do with the create command)

record_id = self.create(cr, uid,

      {'full_name': item['bank']['full_name'],
        'logo' : item['bank']['logo'],
        'website': item['bank']['website'],
        'bank_id': item['bank']['id'],
        'short_name': item['bank']['short_name'],},
      context)

[1] [Traceback](http://pastebin.com/EGkPKRGz)

[2] [obp_client.py](http://pastebin.com/fDFFbSPm) (Note: File slightly changed - Line numbers may vary)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

HI,

no need put attribute ['bank'].

record_id = self.create(cr, uid,

  {'full_name': item['full_name'],
    'logo' : item['logo'],
    'website': item['website'],
    'bank_id': item['id'],
    'short_name': item['short_name'],},
  context)

Bye

Ảnh đại diện
Huỷ bỏ
Tác giả

There is NO issue with the attribute 'bank'. (Yes, I know its a bit odd looking, but thats the kind of object I get from an old API). There is something wrong with the create command itself.

Câu trả lời hay nhất

Hi ,

you have forgot to import pooler ...

from openerp import pooler

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 23
1689
0
thg 12 22
2829
2
thg 7 23
2654
0
thg 11 20
5339
1
thg 12 19
10340