I want to raise an error if something specific happens and also show it in the UI. how can I do it?
This question has been flagged
2
Odpovědi
31685
Zobrazení
You can raise any odoo exception which will show the error message in the popup.
Ex:
from odoo.exceptions import ValidationError
raise ValidationError("This is error message.")
UserError exception should be used in all cases where some action should not be allowed, when it goes against logic.
if not self.checkout_ids:
raise exceptions.UserError('Select at least one Checkout to send messages to.')
if not self.message_body:
raise exceptions.UserError('Write a message body to send.')
To Know More About different types of exceptions refer :
https://www.cybrosys.com/blog/raising-exceptions-odoo-13
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Přihlásit se| Related Posts | Odpovědi | Zobrazení | Aktivita | |
|---|---|---|---|---|
|
|
2
úno 24
|
27951 | ||
|
|
1
srp 23
|
4193 | ||
|
|
1
čvc 22
|
5040 | ||
|
|
2
bře 22
|
5198 | ||
|
|
0
lis 20
|
8797 |