Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2843 มุมมอง

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
4005
3
มี.ค. 15
13543
0
ต.ค. 19
2722
1
ต.ค. 23
2676
1
ก.ย. 20
2728