How can I display log message in openerp web client?

前端 未结 5 1564
执念已碎
执念已碎 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:34

    In my opinion, the easiest way is to use either the "action_info" or "action_warn" client action. They both produce Growl-like notifications, but they use different icons. To invoke either one, return a dictionary from your server action like the following:

    {
        'type': 'ir.actions.client',
        'tag': 'action_info',
        'name': 'Notification',
        'params': {
           'title': 'Notification Title',
           'text': 'Notification text.',
           'sticky': True
        }
    }
    

    Most of this should be self-explanatory aside from the sticky parameter. sticky indicates whether the notification should remain until the user dismisses it. If it's set to False, it'll fade away on its own after a few seconds.

    There's a somewhat fuller example on my blog, if you need one.

提交回复
热议问题