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 strange behavior in Odoo 8.0

By
Hesham ELMAHDY
on 1/11/15, 12:52 PM 920 views

I am traing 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 ..."`

 

I get the following error:

`File "/home/hesham/odootecdev/odootec_product/odootec_product.py", line 30
    @api.onchange(product_code):
                               ^
SyntaxError: invalid syntax

`

 

if I remove the colon from the code like this:

 

`@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?

question edited.. sorry please read again

Hesham ELMAHDY
on 1/11/15, 2:33 PM

Thanks for the people who answer, but I edited the question, please read again

Hesham ELMAHDY
on 1/11/15, 2:36 PM
1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/11/15, 1:09 PM

Do the following:

@api.onchange('product_code')
def make_uppercase(self):
    print "something"

Hope this helps !!.

Thanks you. That is what I did. but gives the looping error

Hesham ELMAHDY
on 1/11/15, 2:38 PM

Did you tried copy & paste of my code. Still I can see that you not put "single quote" around the field "product_code" in @api.onchange line. This code definitely works.

Emipro Technologies Pvt. Ltd.
on 1/11/15, 11:42 PM
Perfect. Thank you so much for being patient.

On Mon, Jan 12, 2015 at 7:42 AM, Emipro Technologies Pvt. Ltd. <erp@emiprotechnologies.com> wrote:

Did you tried copy & paste of my code. Still I can see that you not put "single quote" around the field "product_code" in @api.onchange line. This code definitely works.

Emipro Technologies is best in Odoo & eCommerce Application development based outsourcing software firm. We deliver any kind of complex solutions in the domain of Odoo and eCommerce to customers accross the globe. Being in IT business since 2011, We have a strong team of skilled experienced IT experts.Our customers are companies of all sizes ranging from startups to large enterprises who realize that they need a professional internet solution to generate revenue streams, establish communication channels or streamline business operations.

Our Services in Odoo includes,
  • Installation
  • Customization
  • Configuration
  • Software Training
  • After Sale Support
  • Maintenance
  • Consulting
Contact info@emiprotechnologies.com for any kind of queries in Odoo. Visit www.emiprotechnologies.com for more details.




 

Sent by Odoo S.A. using Odoo about Forum Post False



--

Regards,

Hesham ELMAHDY
OdooTec, Techno-functional Advisor

Hesham ELMAHDY
on 1/12/15, 5:52 AM
2

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 1/11/15, 2:22 PM

Hi Hesham, the error occured because as shown the syntax is wrong. No need to put colon after @api.onchange(). Also the field name should be in quotes.

Thanks you. That is what I did. but gives the looping error

Hesham ELMAHDY
on 1/11/15, 2:38 PM
0
Hesham ELMAHDY
On 1/11/15, 2:40 PM

Someone with a priviledge, please delete this question. i will re-post it

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, 12:52 PM
Seen: 920 times
Last updated: 3/16/15, 8:10 AM