diff options
| author | Antony Lesuisse <al@openerp.com> | 2014-04-25 01:52:54 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2014-04-25 01:52:54 +0200 |
| commit | 95a9bccb380a0eed8f7904dab61e99721457c4b6 (patch) | |
| tree | 007158a0b62e0562d3c00a12d07ddeb1032852ea /addons/project_long_term/wizard/project_compute_phases.py | |
| parent | dfa56e6b5466c82d66f7977cc0b9e477d9edb97e (diff) | |
[REM] move project_long_term to extra
bzr revid: al@openerp.com-20140424235254-u2um2dsth6igvb7r
Diffstat (limited to 'addons/project_long_term/wizard/project_compute_phases.py')
| -rw-r--r-- | addons/project_long_term/wizard/project_compute_phases.py | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py deleted file mode 100644 index 751265d5eba..00000000000 --- a/addons/project_long_term/wizard/project_compute_phases.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). -# -# 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 <http://www.gnu.org/licenses/>. -# -############################################################################## -from openerp.tools.translate import _ -from openerp.osv import fields, osv - -class project_compute_phases(osv.osv_memory): - _name = 'project.compute.phases' - _description = 'Project Compute Phases' - _columns = { - 'target_project': fields.selection([ - ('all', 'Compute All My Projects'), - ('one', 'Compute a Single Project'), - ], 'Action', required=True), - 'project_id': fields.many2one('project.project', 'Project') - } - _defaults = { - 'target_project': 'one' - } - - def check_selection(self, cr, uid, ids, context=None): - return self.compute_date(cr, uid, ids, context=context) - - def compute_date(self, cr, uid, ids, context=None): - """ - Compute the phases for scheduling. - """ - project_pool = self.pool.get('project.project') - data = self.read(cr, uid, ids, [], context=context)[0] - if not data['project_id'] and data['target_project'] == 'one': - raise osv.except_osv(_('Error!'), _('Please specify a project to schedule.')) - - if data['target_project'] == 'one': - project_ids = [data['project_id'][0]] - else: - project_ids = project_pool.search(cr, uid, [('user_id','=',uid)], context=context) - - if project_ids: - project_pool.schedule_phases(cr, uid, project_ids, context=context) - return self._open_phases_list(cr, uid, data, context=context) - - def _open_phases_list(self, cr, uid, data, context=None): - """ - Return the scheduled phases list. - """ - if context is None: - context = {} - mod_obj = self.pool.get('ir.model.data') - act_obj = self.pool.get('ir.actions.act_window') - result = mod_obj._get_id(cr, uid, 'project_long_term', 'act_project_phase') - id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] - result = act_obj.read(cr, uid, [id], context=context)[0] - result['target'] = 'current' - project_id = data.get('project_id') and data.get('project_id')[0] or False - result['context'] = {"search_default_project_id":project_id, "default_project_id":project_id, "search_default_current": 1} - return result - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
