Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2807 Lượt xem

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 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 19
3991
3
thg 3 15
13519
0
thg 10 19
2707
1
thg 10 23
2633
1
thg 9 20
2700