How can I display log message in openerp web client?

前端 未结 5 1438
执念已碎
执念已碎 2021-01-23 21:42

I try to display a message after create a product object that tell user product with product.name is created successful This is the code:

def log_prod(self, cr,          


        
5条回答
  •  孤城傲影
    2021-01-23 22:11

    def log_prod(self, cr, uid, ids, context=None):
            product=self.pool.get('product.product').browse(cr, uid, ids)
            msg=_("Product %s has been created") % product.name
            self.message_post(cr, uid, ids, body=msg, context=context)
            return True
    
    def create(self, cr, uid, data, context=None):
        new_id = super(product_product,self).create(cr, uid, data, context)
        self.log_prod(cr,uid,new_id,context)
        return new_id
    

    Like this code try.

    Hope this will help you. :)

提交回复
热议问题