Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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.



Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Jul 25
496
0
Sep 19
2668
3
Jun 25
2814
2
Feb 25
1535
0
Nov 24
1278