Odoo Help


Using message_post()

Alex Gallien
on 8/6/14, 7:05 PM 1,513 views

I am trying to use message_post() to add a message to the OpenChatter log whenever a product is changed in a sales order line. From what I can tell, that involves using mail.thread.message_post(). I figured that it should be included in the product_id_change function in sales.order.line so that it is called every time that a product is changed. My code looks something like this

class sales_order_detail_field(osv.Model):

    _name = 'sale.order.line'

    _inherit = ['sale.order.line','mail.thread']

    _columns = {

        'line_comment': fields.text('Comment'),

        'part_no': fields.related('product_id', 'default_code', type='char', string ="Part Number"),


    def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):


{bulk of the product_id_change function that is irrelevant to this}


        self.message_post(cr, uid, ids, subject='Product Change', body="A sales order line has been changed")

        return {'value': result, 'domain': domain, 'warning': warning}


I feel like this should post a message every time the product is changed in a SO line, but nothing happens. I am not getting any errors at this point, but am also not getting any messages. Any idea why? Thanks!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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

2 follower(s)


Asked: 8/6/14, 7:05 PM
Seen: 1513 times
Last updated: 3/16/15, 8:10 AM