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

Hello and good day.

I want to ask and consult if there are any ways, through back-end or front-end, to disable 'Ok' in the Confirmation wizard so that it won't be clicked twice. Clicking the 'Ok' causes record inconsistencies, allowing multiple records to be created or modified.

Thank you so much!

Avatar
Zrušit
Nejlepší odpověď

Hi,

Please refer to the code:

from odoo import models, api

from odoo.exceptions import UserError


class YourWizard(models.TransientModel):

    _name = 'your.wizard'

   

    @api.model

    def action_confirm(self):

        if self.env.context.get('already_confirmed', False):

            raise UserError("This wizard has already been confirmed!")

       

        # Prevent double processing

        self = self.with_context(already_confirmed=True)

       

        # Your confirmation logic here

        # e.g., create records, update records


Hope it helps.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
srp 22
9549
9
lis 22
11077
1
srp 22
8237
3
srp 22
6451
1
čvc 22
12208