تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2829 أدوات العرض

Hey there!

Hope y'll doing good!

Am learning Odoo 13 Technical fundamentals.

I've encountered with an confusion on how to raise validation error using python constraint, while the remaining hours exceeds the planned hours in project module in odoo 13.


I have enabled the timesheet page from notebook in project module by

configuration -> settings -> checking the boolean "Task Logs" as shown below:



Where after that, i got following tab:




Here, i have hovered over remaining hours and i've changed using following python code:


@api.constrains('remaining_hours')

    def check_remaining_hours(self):

        for task in self.remaining_hours:

            if task.remaining_hours > 50:

                raise ValidationError("Remaining Hours must not exceed Planned Hours!")


but please let me know what's the right way to tackle the above problem.


Thanks for the help! if helped!

الصورة الرمزية
إهمال
أفضل إجابة

Please use a cron job/scheduler to find whether the remaining hours of any task will exceeds from the planned hours, On the scheduler we can setup the execution time which as we want. So system will identify those cases and also implement a mail function along with this scheduler. At that moment Odoo will trigger the mail function and the project manager will get an intimation mail.

Try this case too. Hope it works fine for this scenerio

الصورة الرمزية
إهمال
أفضل إجابة

Great

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
4
مايو 21
28820
2
نوفمبر 23
8775
0
يوليو 20
2931
1
نوفمبر 19
6368
0
مايو 24
1282