Odoo Help

Welcome!

This community 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.

-1

What mean the comment 'List Indices' ?

By
heru
on 4/5/15, 8:14 PM 534 views

Hi, I make sequence when press button 'regis' , but it's not work.

i don't know mean the error .

this is code in .py :

class hs_aplikan(osv.osv):

_name = 'hs.aplikan'

def process_regis(self, cr, uid, ids, context=None):

self.write(cr, uid, ids,{'state':'regis'})

def regis(self, cr, uid, vals, context=None):

obj = self.pool.get('gelombang.pendaftaran').browse(cr, uid, vals['tahun_akademik_id']).name.name.tahun  

seq_name = 'D{0}'.format(obj_s)

seq = self.pool.get('ir.sequence')

ids = seq.search(cr, uid, [('name','=',seq_name)])

if not ids:

prefix = seq_name

ids = seq.create(cr, uid, {

'name':seq_name,

'prefix': prefix,

'padding': 4,

'implementation': 'no_gap',

})

vals['name'] = seq.get_id(cr,uid,ids)

res = super(hs_aplikan, self).create(cr, uid, vals, context=context)

self.process_regis(cr, uid, [res])

return res

_columns = {

'state': fields.selection([('aplikan','Aplikan'),('regis','Regis')],'Status', readonly=True),

'name': fields.char('No Aplikan'),

'no_regis': fields.char('No Regis'),

}


this is code in .xml :

<header>

<button name="regis" string="Regis" type="object" icon="gtk-apply" attrs="{'invisible':[('state','!=','aplikan')]}" />

</header>


when i press button 'regis' , error like this :

2015-04-06 00:08:01,348 2643 ERROR Db_0 openerp.http: Exception during JSON request handling.

Traceback (most recent call last):

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 499, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 516, in dispatch

result = self._call_function(**self.params)

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 282, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/home/heru/odoo/openerp-8.0/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 279, in checked_call

return self.endpoint(*a, **kw)

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 732, in __call__

return self.method(*args, **kw)

File "/home/heru/odoo/openerp-8.0/openerp/http.py", line 375, in response_wrap

response = f(*args, **kw)

File "/home/heru/odoo/addons/Campus/web/controllers/main.py", line 948, in call_button

action = self._call_kw(model, method, args, {})

File "/home/heru/odoo/addons/Campus/web/controllers/main.py", line 936, in _call_kw

return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

File "/home/heru/odoo/openerp-8.0/openerp/api.py", line 237, in wrapper

return old_api(self, *args, **kwargs)

File "/home/heru/odoo/addons/Campus/hs_proses_pmb/hs_aplikan.py", line 34, in daftar

obj_s = obj.browse(cr, uid, vals['tahun_akademik_id']).name.name.tahun

TypeError: list indices must be integers, not str


i don't know mean the error.

if you know, please give me solution.

<sorry for my english language is bad>

thanks in advance.

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/5/15, 8:14 PM
Seen: 534 times
Last updated: 4/14/15, 8:21 PM