Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
9754 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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/

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

{ '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>

Ảnh đại diện
Huỷ bỏ