Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7537 Vizualizări

Hello Community,

I would like to show a warning in a Wizard either when you click Print button or with an onchange.
I have the problem that warnings are not working. For raise UserError there is no problems, but the warning is not showing it's just closing the wizard without anything going on. We are talking about Odoo11.

Any idea how to achieve it?

Imagine profil
Abandonează

I m facing the issue ,wizard is closing on any warning/error raise?How can we achieve this.

@Jainesh,

sadly, raising a ValidationError in a wizard is only showing the Oops popup which does not help the user

Cel mai bun răspuns

Hello Dimitar,

For displaying warning pop(i.e wizard) on specific field condition of report. For example report should be print on respected start_date and end_date. If user take end_date greater than start_date, then we need to raise warning and the report will not print.

def print_report(self):
for report in self:
if report.end_date < report.start_date:
raise ValidationError(_('End date should be greater than start date.'))
else:
return self.env['report'].get_action(self, 'sale.report_saleorder')

Or you can also do that by using sql_contrains which as follows:

Suppose I have below fields:

date_start = fields.Date(string='Start Date', default=fields.Date.today)
date_end = fields.Date(string='End Date')

_sql_constraints = [
('date_check', 'check(date_start <= date_end)',
'Start date must be smaller than end date'),
]

Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 20
8753
1
ian. 19
6655
1
mar. 18
5880
9
ian. 25
25104
2
nov. 24
14439