Odoo Help


api.onchange not works

on 12/29/14, 11:11 AM 973 views

Hello, I am developing a module in Odoo 8 and I want to display a message when a value field changes. In this case, I want to display a warning message when the pricelist associated with a sale order changes. This is my code:

class sale_order(models.Model):
    _inherit = 'sale.order'

    def test_change(self):
        return {
        'warning': {
            'title': "test",
            'message': "testing",

I can install the module correctly, but when I change the pricelist selection in sale.order.form, there isn't any warning message. Why?


On 12/30/14, 12:08 AM

I found the solution. The method not works because there is a on_change attribute in the view.xml which calls another method. I override the view, quit the on_change attribute, and then the @api.onchange('pricelist_id') works properly.

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: 12/29/14, 11:11 AM
Seen: 973 times
Last updated: 3/16/15, 8:10 AM