Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2775 Представления

Hello 

I need warning when assigning user for multiple tasks at the same start and end date

So, I need function search for user ID and dates and rais warning 

Аватар
Отменить
Лучший ответ

Hi,

Either you can use the constrains or override the create/write method to show the warning message. First method will be better.

You can add below code in your function,

existing_task = self.env['project.task'].search([('user_id', '=', self.user_id.id), ('date_field', '=', date_value)])
if existing_task:
raise ValidationError(_('Message..!'))


This is just a rough code which is not tested, you can set the search condition accordingly and raise the warning.

Also Check this : Constrains in Odoo

Thanks

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
февр. 19
3963
3
мар. 15
13468
0
окт. 19
2675
1
окт. 23
2548
1
сент. 20
2648