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.

0

@api.onchange causes looping page redirect 302

By
Hesham ELMAHDY
on 1/11/15, 2:46 PM 1,417 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

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
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

 

 

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: 1/11/15, 2:46 PM
Seen: 1417 times
Last updated: 3/16/15, 8:10 AM