Skip to Content
Menu
This question has been flagged
2 Replies
1777 Views

Hi All,

In my app I am inheriting from product.template the view product.product_template_form_view where I then insert a button.

When I try to access a method in my app I just the error message.

my_method is not a valid action on product.template

What do I need to do to get the button to access my method in my custom app?

Avatar
Discard
Best Answer

As error says, your method(my_method) is unable to execute. please make sure that you haved added your method in product.template class and your method related python file is imported into __init__.py file.


Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat 380015
    

CandidRoot Solutions Private Limited

Mobile: (+91) 8849036209
Email : info@candidroot.com
Skype : live:candidroot
Website : https://www.candidroot.com

Avatar
Discard
Best Answer

Hi JEREMY_RCL

You need to define my_method in the inherited "product.template" model.

class ProductTemplate(models.Model):
_inherit = 'product.template'

def my_method(self):
your code

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard
Author

Hi Jainesh,

That solved the problem. Thank you!