0

如何在 ODOO 10 中停止引发验证错误例如在 project.py 文件中,我想停止引发此验证错误:

@api.constrains('date_start', 'date_end')
def _check_dates(self):
    if any(self.filtered(lambda task: task.date_start and task.date_end and task.date_start > task.date_end)):
        raise ValidationError(_('Error ! Task starting date must be lower than its ending date.'))
4

1 回答 1

2

您可以通过覆盖该函数来禁用该警告。试试下面的代码,

@api.constrains('date_start', 'date_end')
def _check_dates(self):
    if any(self.filtered(lambda task: task.date_start and task.date_end and task.date_start > task.date_end)):
       pass;
       #raise ValidationError(_('Error ! Task starting date must be lower than its ending date.'))

希望它会帮助你。

于 2018-05-28T08:02:54.093 回答