Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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.



Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 25
468
0
wrz 19
2666
3
cze 25
2747
2
lut 25
1500
0
lis 24
1266