Odoo Help

0

@api.onchange causes looping page redirect 302

By
Hesham ELMAHDY
on 1/11/15, 2:46 PM 1,830 views

@api.onchange strange behavior in Odoo 8.0

I am trying convert inputs of a field into uppercase using @api.onchange

when I run this code:

@api.onchange(product_code)

def make_uppercase(self):

    print "something ..."

 

then I get this in the log, and it keeps looping foever till browser say `too many redirects`:

2015-01-11 17:40:12,304 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:12,609 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.30s, 0 queries
2015-01-11 17:40:12,624 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:12,868 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:12] "GET /web HTTP/1.1" 302 -
2015-01-11 17:40:12,880 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:13,071 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.19s, 0 queries
2015-01-11 17:40:13,086 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:13,325 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:13] "GET /web HTTP/1.1" 302 -
2015-01-11 17:40:13,333 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:13,515 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.18s, 0 queries
2015-01-11 17:40:13,531 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:13,861 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:13] "GET /web HTTP/1.1" 302 -
2015-01-11 17:40:13,870 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:14,058 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.19s, 0 queries
2015-01-11 17:40:14,072 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:14,313 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:14] "GET /web HTTP/1.1" 302 -
2015-01-11 17:40:14,323 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:14,512 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.19s, 0 queries
2015-01-11 17:40:14,526 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:14,774 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:14] "GET /web HTTP/1.1" 302 -
2015-01-11 17:40:14,785 21077 INFO goboraq openerp.modules.loading: loading 1 modules...
2015-01-11 17:40:15,071 21077 INFO goboraq openerp.modules.loading: 1 modules loaded in 0.29s, 0 queries
2015-01-11 17:40:15,086 21077 INFO goboraq openerp.modules.loading: loading 31 modules...
2015-01-11 17:40:15,328 21077 INFO None werkzeug: 127.0.0.1 - - [11/Jan/2015 17:40:15] "GET /web HTTP/1.1" 302 -

 

Any clue?

1
Vasanth
On 1/12/15, 5:42 AM

The parameter in the onchange should be within single quotes.So th code should be

@api.onchange('product_code')

def make_uppercase(self):

    print "something ..."

Sometimes this misake also make the loop ti infinite.Try this one

 

 

About This Community

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

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/11/15, 2:46 PM
Seen: 1830 times
Last updated: 3/16/15, 8:10 AM