Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
2829 Ansichten

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 

Avatar
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Feb. 19
3994
3
März 15
13525
0
Okt. 19
2713
1
Okt. 23
2651
1
Sept. 20
2709