Odoo Help

0

0
1 回答
1
アバター

Axel Mendoza キューバ

--Axel Mendoza--
13876
| 8 8 10
Camaguey, キューバ
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza キューバ
2015/12/22 14:57

You could create an wizard to display that message with one html field that contains the message, like this example I have created in the old api:

from openerp.tools.translate import _

from openerp.osv import fields, osv

class dialog_box(osv.osv_memory):

_name = 'dialog.box'

_description = 'dialog.box'

_columns = {

'title': fields.char(string="Title", size=100, readonly=True),

'message': fields.text(string="Message", readonly=True),

}

_req_name = 'title'

def _get_view_id(self, cr, uid):

"""Get the view id

@return: view id, or False if no view found

"""

res = self.pool.get('ir.model.data').get_object_reference(cr, uid,

'web_ext', 'dialog_box_form')

return res and res[1] or False

def message(self, cr, uid, id, context):

message = self.browse(cr, uid, id)

self.__logger.info('%s: %s' % (message.title, message.message))

res = {

'name': '%s' % _(message.title),

'view_type': 'form',

'view_mode': 'form',

'view_id': self._get_view_id(cr, uid),

'res_model': 'dialog.box',

'domain': [],

'context': context,

'type': 'ir.actions.act_window',

'target': 'new',

'res_id': message.id,

'options': {'width': 400},

}

return res

def show_confirm(self, cr, uid, data, context=None):

id = self.create(cr, uid, data)

res = self.message(cr, uid, id, context)

return res

dialog_box()


<?xml version="1.0" encoding="UTF-8"?>

<openerp>

<data>

<record id="dialog_box_form" model="ir.ui.view">

<field name="name">dialog.box.form</field>

<field name="model">dialog.box</field>

<field eval="20" name="priority"/>

<field name="arch" type="xml">

<form string="Warning">

<field name="message" nolabel="1" widget="html"/>

<footer>

<button string="Ok" class="oe_link" special="cancel"/>

</footer>

</form>

</field>

</record>

</data>

</openerp>

To use it you just need to call:
return self.pool.get('dialog.box').show_confirm(cr, uid, {'message': 'hello world', 'title': 'test'})
and it will display a confirmation window with the provided message and title



2 コメント
Anybox, Sébastien Morele フランス
2015/12/23 1:55

thanks but are you sure your code works ? I cannot see the message into the dialog box :(

Axel Mendoza キューバ
2015/12/23 1:59

The dialog box will show the field message, that will take the value that you pass in the show_confirm method call, you could put it there the value you need too, even html, for the example I pass 'hello world' and that is what will display the dialog box

質問する
Keep Informed
1 フォロワー
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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now