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

I'm using Odoo 18, and I want to prevent the Inventory user from validating any stock picking (e.g., receipts or deliveries) if the quality check has failed.



الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Please refer to the code below:


from odoo import models, _

from odoo.exceptions import UserError


class StockPicking(models.Model):

    _inherit = 'stock.picking'


    def button_validate(self):

        for picking in self:

            if picking.quality_check_fail:

                raise UserError(_(

                    "You cannot validate this transfer because one or more quality checks have failed."

                ))

        return super(StockPicking, self).button_validate()


Hope it helps.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يوليو 25
460
0
سبتمبر 19
2665
3
يونيو 25
2736
2
فبراير 25
1496
0
نوفمبر 24
1263