I want to raise an error if something specific happens and also show it in the UI. how can I do it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
2
Odpowiedzi
29059
Widoki
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
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
lut 24
|
24756 | ||
|
1
sie 23
|
2172 | ||
|
1
lip 22
|
2996 | ||
ValueError: Field `sequence` does not exist
Rozwiązane
|
|
2
mar 22
|
2749 | |
|
0
lis 20
|
6680 |