コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
218 ビュー

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.

アバター
破棄
関連投稿 返信 ビュー 活動
3
8月 22
9542
9
11月 22
11065
1
8月 22
8224
3
8月 22
6444
1
7月 22
12179