Odoo Help

4

2
1 Answer
2
Avatar

Parth Gajjar India

--Parth Gajjar--
3585
| 4 4 7
Gandhinagar, India
--Parth Gajjar--

Former R&D Developer, Odoo India.
Author of Odoo 12 Development Cookbook

Parth Gajjar India
4/2/13, 5:19 AM

Duplicate Button Generate Automatically

Duplicate Button will generate automatically in every form.

image description

You just need to override copy function if you want some changes in default copy function.

def copy(self, cr, uid, id, default=None, context=None):
    #your changes
    default_return_value=super("your parent class", self).copy(cr, uid, id, default, context)
    #your changes in "default_return_value"
    return default_return_value
1 Comment
Mathieu Stumpf France
1/23/14, 11:29 AM

I'm doing just that to prevent a constraint which doesn't allow two objects with the same name to exist for my current class. But when I try to duplicate, the constraint error rise anyway. Should I overload something in the form view to make the button call my overloaded _copy_ method?

Ask a Question
Writer
Tag
Keep Informed
2 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