diff options
| author | Rvo (Open ERP) <rvo@tinyerp.co.in> | 2010-02-26 19:30:28 +0530 |
|---|---|---|
| committer | Rvo (Open ERP) <rvo@tinyerp.co.in> | 2010-02-26 19:30:28 +0530 |
| commit | d72306939b1fc1ff30f1f06a2bf9f3e472a28f42 (patch) | |
| tree | 5206e169e5214157789ff41a9d92ca5bd798edfe /addons/project_long_term/project.py | |
| parent | 64b2f5447f44dee314230597eafd7059ab23d3c1 (diff) | |
[ADD] constraints on constraint date start and constrint date end for phase's start and end
bzr revid: rvo@tinyerp.co.in-20100226140028-fdgt9ltb4k7xue2r
Diffstat (limited to 'addons/project_long_term/project.py')
| -rw-r--r-- | addons/project_long_term/project.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/addons/project_long_term/project.py b/addons/project_long_term/project.py index df21511434f..5bad633e7b0 100644 --- a/addons/project_long_term/project.py +++ b/addons/project_long_term/project.py @@ -78,6 +78,19 @@ class project_phase(osv.osv): return False return True + def _check_constraint_start(self, cr, uid, ids): + phase = self.read(cr, uid, ids[0],['date_start','constraint_date_start']) + if phase['date_start'] and phase['constraint_date_start']: + if phase['date_start'] < phase['constraint_date_start']: + return False + return True + + def _check_constraint_end(self, cr, uid, ids): + phase = self.read(cr, uid, ids[0],['date_end','constraint_date_end']) + if phase['date_end'] and phase['constraint_date_end']: + if phase['date_end'] > phase['constraint_date_end']: + return False + return True _columns = { 'name': fields.char("Phase Name", size=64, required=True), @@ -110,7 +123,10 @@ class project_phase(osv.osv): _order = "name" _constraints = [ (_check_recursion,'Error ! Loops In Phases Not Allowed',['next_phase_ids','previous_phase_ids']), - (_check_dates, 'Error! Phase start-date must be lower then Phase end-date.', ['date_start', 'date_end']) + (_check_dates, 'Error! Phase start-date must be lower then Phase end-date.', ['date_start', 'date_end']), + (_check_constraint_start, 'Error! Phase must start-after Constraint Start Date.', ['date_start', 'constraint_date_start']), + (_check_constraint_end, 'Error! Phase must end-before Constraint End Date.', ['date_end', 'constraint_date_end']), + ] def onchange_project(self,cr,uid,ids,project): |
