Skip to Content
Menú
This question has been flagged
2 Respostes
1737 Vistes

Hello all,


I would like to display a confirmation popup when saving, creating, or modifying a field. Cancel popup will cancel modifications.

Doable with inherit of methods write, create,..


But, the difficulty is that I want to allow the user to choose the fields that trigger the popup call.

How to proceed dynamically?


Thank you in advance !


Jérôme

Avatar
Descartar
Autor Best Answer

Hello Creyox Technologies,

Thanks, nice approach.

However, write method doesn't open my action to show the wizard, and I think she can't.

Any alternatives ? 

class Esignature(models.Model):
    _inherit = 'res.partner'

    @api.multi
    def write(self, vals):
        rc = super(Esignature, self).write(vals)

        # Resarch in modified vals in field need confirmation
        for val in vals:
            field_rc = self.env['ir.model.fields'].search([('model', '=', self.model.model), ('name', '=', val), ('need_confirm', '=', True)])
            if field_rc:  # Confirmation needed, show confirmation wizard
                return {
                    'name': 'Open Wizard',
                    'type': 'ir.actions.act_window',
                    'res_model': 'a4.password.request',
                    'view_mode': 'form',
                    'target': 'new',
                }

        return rc



Avatar
Descartar
Best Answer

Hello,

You can put a boolean field inside the ir.fields models to identify whether this field is a popup call field or not.
If you get a modified field in the popup call field then you can trigger the popup.

Thanks,
info@creyox.com

Avatar
Descartar
Related Posts Respostes Vistes Activitat
4
d’oct. 16
4076
3
d’abr. 18
5037
2
d’abr. 23
23132
4
de juny 25
1848
1
de juny 25
709