I have defined a constraint on model "sale.order". On the backend, I raise a warning (exceptions.Warning) message when a condition is not satisfied: there it works fine. The problem come on the website: when the warning's condition is not satisfied odoo raise the classical 500 page error. How can I manage this error through show an alert window or a message for the user in a pretty way? I suppose I can re-define the structure of 500 page error, but I want to manage this error like other classical error(field required, ....). Thanks
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ờ
This can be done using js and qweb website templates.
You have to catch the proper errors and pass this to the desired js function or xml template. From here qweb website templates can check the values you have given while rendering using t-if command, so you can make the desired field in required. From js you can call python function and from here you can return the values. Follow the same steps to make the field required.
Checkout Website_payment module controller. or in login
Sample code:
pass the error msg in controller
{
'error': {},
'error_message': [],
'return_url': return_url,
'json': False,
'bootstrap_formatting': True
}
and in XML template
<xpath expr="//div[@class='clearfix']"
position="before">
<div>
<p class="alert alert-danger" t-if="error">
<t t-esc="error"/>
</p>
</div>
</xpath>
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ýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
Clean up Website Quotations
Đã xử lý
|
|
2
thg 9 24
|
4296 | |
|
1
thg 3 18
|
4806 | ||
|
1
thg 8 25
|
445 | ||
|
1
thg 5 24
|
2740 | ||
|
1
thg 5 24
|
2765 |