I work to add some warning messages (non blocking) in my custom. Any one tell me how can i display a warning message.
Thanks,
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I work to add some warning messages (non blocking) in my custom. Any one tell me how can i display a warning message.
Thanks,
Hello Manoj,
You can try this
return {
'warning': {
'title': 'Warning!',
'message': 'Your warning text here.'}
}
Regards
Hi, I have the same problem, and I used the following format in my code, but it does not display any message:
I want to display a warning message on a custom button (btc_approved) in sale.order.
I don't know what the issue is!
I understand this method is typically used under the onchange decorator, but I don’t have a field to use with onchange. Is there any alternative solution?
Here is my method:
def btc_approved(self):
for record in self:
user = record.user_id
if record.b2c_status != 'ready':
raise ValidationError(_("Only B2C Sale Orders with Ready can be Approved"))
elif record.b2c_sales == False:
raise ValidationError(_("Only B2C Sale Orders can be Approved"))
else:
if user.has_group('vatanzarin_security.visitor_group') and record.b2c_status == 'ready':
partner = record.partner_id
if partner.sale_warn and partner.sale_warn_msg != 'no_message':
return {
'warning': {
'title': _("There is a warning note for %s") % partner.name,
'message': partner.sale_warn_msg,
'type': 'notification',
}
}
record.b2c_status = 'approved'
record.financial_status = 'approved'
record.sudo().trigger_picking_atv(True)
Hi
You can use ValidationError or Usererrors to display warning messages
from odoo.exceptions import ValidationError, UserError
def action_confirm(self):
if (apply the condition):
raise UserError(_('Warning Message'))
<button string="Update" name="action_update"
|
Regards
Thanks for the answer Bella James,
But this will block the flow, i want not to stop the flow of code
Check the Updated answer
相關帖文 | 回覆 | 瀏覽次數 | 活動 | |
---|---|---|---|---|
|
1
10月 22
|
2511 | ||
|
2
8月 24
|
9275 | ||
|
0
4月 22
|
2232 | ||
|
1
6月 25
|
1158 | ||
|
3
7月 25
|
2898 |