Community mailing list archives

community@mail.odoo.com

Re: How to send to user request to reload page or redirect to another action

by
Suzanne Jean-Sébastien
- 09/28/2014 14:28:43
Not really

from openerp import models, fields, api


class Setting(models.TransientModel):
    _name = 'web.action.request.setting'
    _description = 'test the request'
    _inherit = 'res.config.settings'

    action = fields.Many2one('ir.actions.act_window', required=True)
    user = fields.Many2one('res.users', default=lambda self: self.env.user,
                           required=True)

    @api.multi
    def button_check_action_request(self):
        action = self.action.read()[0]
        self.sudo(self.user.id).env['action.request'].notify(action)
        return True

the self.user.id is many2one one a specifique user so self.sudo(self.user.id) change the env hid for the command notify

2014-09-27 17:06 GMT+02:00 Maxim Litnitskiy <litnimaxster@gmail.com>:

2014-09-26 9:26 GMT+04:00 Jean-Sébastien Suzanne <jssuzanne@anybox.fr>:
You must use long polling with bus module. https://bitbucket.org/anybox/web_action_request 

LOL! This what I was googling for hours!
I remember that some time ago a was surfing and found a solution how to send an action to exact user.
Now I remember, I was comparing implementation of long polling of bus by Odoo and socket.io by Anybox.
self.sudo(self.user.id).env['action.request'].notify(action)
By the way may be it should be implemented on Odoo's bus the same as in socket.io.
Not?
And this is mad feature.



_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Jean-Sébastien SUZANNE
jssuzanne@anybox.fr
06 51 35 50 50