This question has been flagged
2 Replies
8834 Views

Hello,

Can anyone help me with this. I would like to display a message to the user. The type of message that appears in the top right corner (example: "Odoo Apps will be available soon Showing locally available modules" when you click on Apps).

Thank you.

Avatar
Discard
Author Best Answer

In short:

return {
      'type': 'ir.actions.client',
      'tag': 'action_warn',
      'name': 'Failure',
      'params': {
            'title': 'Postage Cancellation Failed',
            'text': 'Shipment is outside the void period.',
            'sticky': True
            }
       }

This guy explains it better :
http://ryepdx.com/2014/12/message-boxes-in-openerpodoo/

Avatar
Discard
Best Answer

{ 'type': 'ir.actions.client', 'tag': 'action_warn', 'name': 'Failure', 'params': { 'title': 'Postage Cancellation Failed', 'text': 'Shipment is outside the void period.', 'sticky': True } }

Here’s a fuller example for those of you who need more illustration:

from openerp.osv import fields, osv from openerp.tools.translate import _ class growling_growler(osv.osv): _name = "growling.growler" _columns = { 'name': fields.char( 'Name', size=32, required=True ) } def growl(self, cr, uid, ids, context=None): return { 'type': 'ir.actions.client', 'tag': 'action_info', 'name': _('Growl'), 'params': { 'title': _('Grr...'), 'text': _('I am growling at you!'), 'sticky': False } }

<?xml version="1.0" encoding="UTF-8"?> <openerp> <data> <record id="growling_growler_tree" model="ir.ui.view"> <field name="name"> growling.growler.tree </field> <field name="model"> growling.growler </field> <field name="arch" type="xml"> <tree string='Growling Growlers'> <field name='name'/> <button string="Growl!" name="growl" type="object" /> </tree> </field> </record> </data>

Avatar
Discard