Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
1717 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
4
říj 16
4067
3
dub 18
5027
2
dub 23
23111
4
čvn 25
1815
1
čvn 25
666