Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
180 Представления

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!

Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
авг. 22
9536
9
нояб. 22
11050
1
авг. 22
8207
3
авг. 22
6438
1
июл. 22
12167