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

Expected singleton

By
Ajeng Shilvie
on 12/20/14, 5:28 AM 12,232 views

i have a problem when executing a method ,

def wtc_approval(self, cr, uid, ids,vals, context=None):
        user = self.pool.get("res.users").browse(cr, uid, uid)['groups_id']
        line = self.browse(cr, uid, ids, context=context)
    
        for x in user:
            if line.app_line.group_id == x :
                line.app_line.write({
                                       'sts':'2',
                                       'pelaksana':uid,
                                       'tanggal':datetime.today()
                                       })
            print "adaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",x
   
        return True

it said

ValueError

Expected singleton: wtc.approval.line(166, 167, 168, 169)

what should i do ?

 

If you use the list of Objects or List in the place of single value python will raise the error. Try use x.id instead of x. Also ensure that print line.app_line.group_id & print x.id should be single values(Not Links or Pointer).

Rajiv
on 12/20/14, 7:10 AM

Just an idea: def self.browse() ...

Med Said BARA
on 12/20/14, 10:09 AM

i suppose you are using V8 ?

Med Said BARA
on 12/20/14, 10:17 AM

Hi, please let me know if my answer helps you to solve the problem?

Baiju
on 12/22/14, 3:09 AM
3

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 12/21/14, 10:40 AM

hi,

here you have to itereate line because it contains more than one record. Thats reason for Error

-1
lenin
On 2/25/16, 2:07 PM

Hola resolvi el problema para esto dirigete a mi pagina ahi explico como hacer algo similar.

@api.multi

def onchange_get_organizer_account(self,auxType):

if auxType:

ids=self.env['gol.organizer.account'].search([['organizerType', '=', auxType]])

auxIds=[]

for item in ids:

auxIds.append(item.id)

print ids

print auxIds

return {'domain':{'organizerAccount':[('id','in',auxIds)]}}

@api.onchange('organizerAccount','code')

def getCode(self):

if self.organizerAccount:

self.code=self.organizerAccount.code



Para mayor informacion accede ami pagina eln la cual descrivo con mayor detenimiento


https://github.com/Leningsv/Odoo/wiki/Dominios,-Busquedas-(env,-browse,-search),-Filtros,-Agrupamientos

WHAT ? govorish pa Angliski tovorishch ?

Dr Obx
on 3/31/16, 4:30 AM

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

6 follower(s)

Stats

Asked: 12/20/14, 5:28 AM
Seen: 12232 times
Last updated: 3/31/16, 3:11 AM