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

TypeError: name_get() takes exactly 6 arguments (5 given) [Closed]

By
Susi
on 12/27/14, 6:11 AM 2,517 views

The Question has been closed

by
Susi
on 01/21/2016 23:15:22

i have use this code for onchange and its work

   def name_get(self, cr, uid, ids, kecamatan_id,city_id):
        print"--------------------------",kecamatan_id
        if kecamatan_id:
            city= self.pool.get("wtc.kecamatan").browse(cr, uid, kecamatan_id)
            return {'value': {'city_id':city.city_id.id,'province_id':city.province_id.id}}

in my .xml

 <field name="kecamatan_id" on_change="name_get(kecamatan_id, city_id)"/>

when i hit save button version error but the data successfully saved

TypeError: name_get() takes exactly 6 arguments (5 given)

and when i choose one data , itss\ error like this

TypeError: name_get() got an unexpected keyword argument 'context'

whats should i fix with my code ? please help me

1
Susi
On 12/28/14, 10:11 PM

@Baiju

its still error even i add context=None

TypeError: name_get() takes at least 6 arguments (5 given)

what should i do with my code..hope u can help me

1

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/27/14, 10:38 PM

Hi Susi,

You have to pass context argument to that onchange function. Try this:-

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

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/29/14, 1:25 AM

name_get is a special ORM method and the signature must be name_get(self, cr, user, ids, context=None).  So, you cannot pass in kecamatan_id and city_id.  If you want to use it for onchange, change the method name to something else (not name_get).

its work thank u

Susi
on 12/29/14, 6:16 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/27/14, 6:11 AM
Seen: 2517 times
Last updated: 1/21/16, 11:15 PM