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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 7 25
|
458 | ||
|
0
thg 9 19
|
2665 | ||
|
3
thg 6 25
|
2733 | ||
|
2
thg 2 25
|
1496 | ||
|
0
thg 11 24
|
1260 |