تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
89 أدوات العرض

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
أغسطس 22
9528
9
نوفمبر 22
11040
1
أغسطس 22
8187
3
أغسطس 22
6414
1
يوليو 22
12152