gdaramouskas
gdaramouskas

Reputation: 3747

Show a popup when saving a record on Odoo/Openerp

I would like to show a popup upon the modification of a record. More like a custom verification dialog in which the user will input some extra data before the final saving.

My issue is that I cannot show a popup dialog with 'ir.actions.act_window'.

I try to return a dictionary as indicated by https://www.odoo.com/documentation/8.0/reference/actions.html

but it seems to be completely ignored. This is write method overriden:

def write(self, cr, uid, ids, vals, context=None):
    return_value = super(hr_holidays, self).write(cr, uid, ids, vals, context)
    print 'overriden write'
    view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'leave_request_configuration_page')])
    return {
            "type": "ir.actions.act_window",
            "res_model": "hr.holidays",
            "views": [[view_id, "form"]],
            "target": "new",
            }

Is there any chance to show a popup view upon clicking Save on a form?

Upvotes: 3

Views: 1770

Answers (1)

simahawk
simahawk

Reputation: 2431

AFAIK there's no such feature. It would be nice to have, since many ppl have this need, but requires quite some work, especially on JS side.

A workaround for this is to add a text field to the model and display it in the form only in view mode and only if valued. You can populate it via onchange, create and/or write.

Upvotes: 2

Related Questions