Odoo Help

0

How to get element in list using index ?

By
Manish Bohra
on 1/16/18, 1:26 AM 423 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.append(search_val.id)
         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
              else:
                  break
         return True
0

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
12264
| 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 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
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.

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/16/18, 1:26 AM
Seen: 423 times
Last updated: 5/14/18, 5:51 AM