Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
331 Представления

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
467
0
сент. 19
2666
3
июн. 25
2742
2
февр. 25
1498
0
нояб. 24
1264