Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Overbooking time in Tasks

By
wizardz
on 6/4/15, 8:39 AM 642 views

Hello , 

My problem is that I can overbook the time when I write my hours to a task. 

When I get to the time limit, it shows like -2.00hours in the "remaining hours" field.

How can I set this, that the employee can't overbook the time I set.


I need a modul or a way to stop the overbooking on the projects. anyone have an idea?


0
wizardz
On 11/5/15, 8:51 AM

How can I stop the negative number at project.task?

I want to stop that the field "remaining_hours" can go under 0...


I try to build a module for that, but how can I overwrite a function from the odoo basic module "project"?


example: 

    def _hours_get(self, cr, uid, ids, field_names, args, context=None):

res = {}
cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id IN %s GROUP BY task_id",(tuple(ids),))
hours = dict(cr.fetchall())
for task in self.browse(cr, uid, ids, context=context):
res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': (task.remaining_hours or 0.0) + hours.get(task.id, 0.0)}
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours
res[task.id]['progress'] = 0.0
if (task.remaining_hours < 0 ):
task.planned_hours = 100.0
if (task.remaining_hours + hours.get(task.id, 0.0)):
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
# TDE CHECK: if task.state in ('done','cancelled'):
if task.stage_id and task.stage_id.fold:
res[task.id]['progress'] = 100.0
return res
0

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

Tarek Mohamed Ibrahim
On 6/27/15, 12:13 PM

I think you can do this restriction by coding, i.e. in the write method of the task screen add a check that the final remaining hours must be greater than zero 

?

wizardz
on 10/16/15, 8:43 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/4/15, 8:39 AM
Seen: 642 times
Last updated: 11/5/15, 8:51 AM