Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
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
pass the error msg in controller
and in XML template
<p class="alert alert-danger" t-if="error">
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/5/16, 9:34 AM|
|Seen: 844 times|
|Last updated: 2/18/18, 1:58 PM|