diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index c63e19bd582..1cf2eba9660 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -463,10 +463,12 @@ class hr_attendance(osv.osv): FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ + LEFT JOIN resource_resource r \ + ON (e.resource_id = r.id) \ ON (a.employee_id = e.id)) \ ON (s.date_to >= date_trunc('day',a.name) \ AND s.date_from <= a.name \ - AND s.user_id = e.user_id) \ + AND s.user_id = r.user_id) \ WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \ GROUP BY a.id") res = dict(cursor.fetchall()) diff --git a/addons/project/project.py b/addons/project/project.py index 04df471b31a..b5865f8bd94 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -324,13 +324,13 @@ class task(osv.osv): default['work_ids'] = [] return super(task, self).copy_data(cr, uid, id, default, context) - def _check_date(self,cr,uid,ids): - for res in self.browse(cr,uid,ids): - if res.date_start and res.date_end: - if res.date_start > res.date_end: - return False - return True - + def _check_dates(self, cr, uid, ids): + task = self.read(cr, uid, ids[0],['date_start','date_end']) + if task['date_start'] and task['date_end']: + if task['date_start'] > task['date_end']: + return False + return True + _columns = { 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the task without removing it."), 'name': fields.char('Task Summary', size=128, required=True), @@ -380,6 +380,9 @@ class task(osv.osv): } _order = "sequence, priority, date_deadline, id" + _constraints = [ + (_check_dates, 'Error! task start-date must be lower then task end-date.', ['date_start', 'date_end']) + ] # # Override view according to the company definition # diff --git a/addons/project/project_wizard.xml b/addons/project/project_wizard.xml index a9b7ade39b5..785dd9f599c 100644 --- a/addons/project/project_wizard.xml +++ b/addons/project/project_wizard.xml @@ -3,10 +3,21 @@ + + + + + + diff --git a/addons/project/wizard/__init__.py b/addons/project/wizard/__init__.py index b724bd6e7ca..9d90ce8ed90 100644 --- a/addons/project/wizard/__init__.py +++ b/addons/project/wizard/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,13 +15,15 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## import close_task import task_delegate +import compute_tasks_date import duplicate_template_wizard + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project/wizard/compute_tasks_date.py b/addons/project/wizard/compute_tasks_date.py new file mode 100644 index 00000000000..db3c52ba7f2 --- /dev/null +++ b/addons/project/wizard/compute_tasks_date.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import wizard +import pooler +from tools.translate import _ +import datetime +from resource.faces import * + +compute_form = """ +
+ +""" + +success_msg = """ +
+