Skip to Content
Menu
This question has been flagged
2 Replies
1828 Views

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
Discard
Author 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
Discard
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
Discard
Related Posts Replies Views Activity
4
Oct 16
4155
3
Apr 18
5109
2
Apr 23
23239
4
Jun 25
1974
1
Jun 25
813