Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
318 มุมมอง

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 25
458
0
ก.ย. 19
2665
3
มิ.ย. 25
2733
2
ก.พ. 25
1496
0
พ.ย. 24
1260