Odoo Help

5

3
2 Answers
9
Avatar

Sudhir Arya (ERP Harbor Consulting Services) India

--Sudhir Arya (ERP Harbor Consulting Services)--
26932
| 8 9 10
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

ERP Harbor Consulting Services

Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
Sudhir Arya (ERP Harbor Consulting Services) India
6/12/13, 4:17 AM

Add the following code in you py file:

def action_button_verify_bad(self, cr, uid, ids, context=None):
    range = self.search(cr, uid, [], context=context)
    if len(range) > 0:
        range.sort()
        range = range[-1:]
        range = range and range[0]
    else:
        return {}
    next_id = ids and ids[0]
    while True:
        if range == next_id:
            next_id = 1
        next_id += 1
        res_id = self.search(cr,uid,[('id', '=', next_id)], context=context)
        if res_id:
            self.write(cr, uid, ids, {'fail_check': True}, context=context)
            return {
                'name': _("Your Object Name"),
                'res_id': res_id[0],
                'view_type': 'form',
                'res_model': 'sale.order',
                'view_mode': 'form,tree',
                'nodestroy': True,
                'target': 'current',
                'context': context,
                'type': 'ir.actions.act_window',
            }

This will work for sure.

3 Comments
AJ Schrafel Paper Corp United States
6/13/13, 12:46 PM

this worked 95%, i had to add in my view search parameters and the view_id, but your answer got me there.

Sudhir Arya (ERP Harbor Consulting Services) India
6/13/13, 4:37 PM

It's good to hear that it worked.

Michael O. Lambert Canada
3/27/14, 10:45 AM

So useful!! Thanks a lot!

6
Avatar

ClueLogics Technologies Pvt. Ltd. India

--ClueLogics Technologies Pvt. Ltd.--
6213
| 7 5 10
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd. India
6/12/13, 3:22 AM

Hi

for that case you do one thing

          def action_button_verify_bad(self, cr, uid, ids, context=None):
                       for id in ids:
                              next=id+1
                              yes=self.search(cr,uid,[('id','=',next)])
                              if yes:
                                     return {
                                            'name':_("My module name"), 
                                        'view_mode': 'form',
                                        'view_id': False,
                                        'view_type': 'form',
                                        'res_model': 'my.module',
                                        'res_id': yes[0],
                                        'type': 'ir.actions.act_window',
                                        'nodestroy': True,
                                        'target': 'current',
                                        'domain': '[]',
                                            'context': context
                                            }
                              else:
                                    return {'type':'ir.actions.act_window_close'}

Thanks
Sandeep

Ask a Question
Keep Informed
0 follower(s)
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