コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2802 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
2月 19
3983
3
3月 15
13516
0
10月 19
2703
1
10月 23
2628
1
9月 20
2685