How to Block Or Deny user to Add Product in Sale Order line
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1. Please disable "can be sold"
2. You can block the product
Hello,
If its for a specific user group, you could add constraint and raise a validation or user error like in the below code:
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
@api.constrains('product_id')
def _check_product_id(self):
for line in self:
if line.env.user.has_group('base.group_user'):
raise exceptions.UserError("You are not allowed to add products to sale orders.")
Here if the user belongs to the group 'base.group_user', that user will get a popup and will not be able to add products in the order line.
Hope it helps.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
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ý