~elbati/hr-timesheet/7.0_fix_hr_attendance_analysis_useless_computation

« back to all changes in this revision

Viewing changes to timesheet_task/project_task.py

  • Committer: Stefan Rijnhart
  • Author(s): laetitia.gangloff at acsone
  • Date: 2013-05-13 17:28:21 UTC
  • mfrom: (41.1.5 hr-timesheet)
  • Revision ID: stefan@therp.nl-20130513172821-tj3j5j8j6q52qe1l
[IMP] timesheet_task: add constraint to check if task belongs to project
[IMP] hr_timesheet_task: update account domain with ('state','=','open')
        instead of ('state','<>','close')

------------ This line and the following will be ignored --------------

modified:
  hr_timesheet_task/hr_analytic_timesheet_view.xml
  hr_timesheet_task/static/src/js/timesheet.js
  timesheet_task/project_task.py
  timesheet_task/project_task_view.xml
pending merges:
  Laetitia Gangloff 2013-05-13 timesheet_task: remove unused variable proj...
    Laetitia Gangloff 2013-04-24 timesheet_task: reset user column invis...
    Laetitia Gangloff 2013-04-10 hr_timesheet_task: update account domai...
    Laetitia Gangloff 2013-04-10 timesheet_task: add constraint to check...
    Laetitia Gangloff 2013-04-10 timesheet_task: add user column in task...

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
 
126
126
    _columns = {'task_id': fields.many2one('project.task', 'Task')}
127
127
 
 
128
    def _check_task_project(self, cr, uid, ids):
 
129
        for line in self.browse(cr, uid, ids):
 
130
            if line.task_id and line.account_id:
 
131
                if line.task_id.project_id.analytic_account_id.id != line.account_id.id:
 
132
                    return False
 
133
        return True
 
134
 
 
135
    _constraints = [
 
136
        (_check_task_project, 'Error! Task must belong to the project.', ['task_id','account_id']),
 
137
    ]
128
138
 
129
139
    def _compute_hours_with_factor(self, cr, uid, hours, factor_id, context=None):
130
140
        if not hours or not factor_id: