Odoo Help


How to get element in list using index ?

Manish Bohra
on 1/16/18, 1:26 AM 555 views

Hello Everyone,

I have try to get element of list using index . I have get first one element of list but how to get other element one by one or respectively .

My python code below :

     for search_val in stage_obj:
         status_list.sort()for ress in status_list:
         if ress:
             self.workflow_stages = ress
             length = len(status_list)
             for index, item in enumerate(status_list):
             if index < length:
                 next_index = index + 1
                 if index:
                 self.workflow_stages = index
         return True

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 1/16/18, 3:20 AM

Hi Manish,

In your code, you should replace the break statement by continue statement.

break statement in your else condition breaking the whole loop and you are not able to get the next element from the list.

Sudhir Arya
ERP Harbor Consulting Services

skype:sudhir@erpharbor.com  website: http://www.erpharbor.com

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.


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)


Asked: 1/16/18, 1:26 AM
Seen: 555 times
Last updated: 10/11/18, 1:25 PM