diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-06-26 15:25:19 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-06-26 15:25:19 +0200 |
| commit | 8fbfc997aebb788d79200e711389817e9ce719df (patch) | |
| tree | 6ac20665ef2dd12230676cb0fc9ac675ae7d931f /addons/project/wizard | |
| parent | c180afab26171617c1c7c22db5d9836b159e5e7d (diff) | |
[REF] project: stage/status refactoring
Removed concept of state on project.task (and propagated report)
Removed python inheritance towards base_stage (specific code will be re-added)
bzr revid: tde@openerp.com-20130626132519-988nfq8pw8h8c8e8
Diffstat (limited to 'addons/project/wizard')
| -rw-r--r-- | addons/project/wizard/__init__.py | 2 | ||||
| -rw-r--r-- | addons/project/wizard/project_task_reevaluate.py | 84 | ||||
| -rw-r--r-- | addons/project/wizard/project_task_reevaluate_view.xml | 32 |
3 files changed, 0 insertions, 118 deletions
diff --git a/addons/project/wizard/__init__.py b/addons/project/wizard/__init__.py index 7a9a734b2bd..24017d9cbe8 100644 --- a/addons/project/wizard/__init__.py +++ b/addons/project/wizard/__init__.py @@ -20,7 +20,5 @@ ############################################################################## import project_task_delegate -import project_task_reevaluate # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/project/wizard/project_task_reevaluate.py b/addons/project/wizard/project_task_reevaluate.py deleted file mode 100644 index eeb8cccc5d2..00000000000 --- a/addons/project/wizard/project_task_reevaluate.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 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 lxml import etree -from openerp.osv import fields, osv -from openerp.tools.translate import _ - -class project_task_reevaluate(osv.osv_memory): - _name = 'project.task.reevaluate' - - def _get_remaining(self, cr, uid, context=None): - if context is None: - context = {} - active_id = context.get('active_id', False) - res = False - if active_id: - res = self.pool.get('project.task').browse(cr, uid, active_id, context=context).remaining_hours - return res - - _columns = { - 'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Put here the remaining hours required to close the task."), - } - - _defaults = { - 'remaining_hours': _get_remaining, - } - - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): - res = super(project_task_reevaluate, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu) - users_pool = self.pool.get('res.users') - time_mode = users_pool.browse(cr, uid, uid, context).company_id.project_time_mode_id - time_mode_name = time_mode and time_mode.name or 'Hours' - if time_mode_name in ['Hours','Hour']: - return res - - eview = etree.fromstring(res['arch']) - - def _check_rec(eview): - if eview.attrib.get('widget','') == 'float_time': - eview.set('widget','float') - for child in eview: - _check_rec(child) - return True - - _check_rec(eview) - - res['arch'] = etree.tostring(eview) - - for field in res['fields']: - if 'Hours' in res['fields'][field]['string']: - res['fields'][field]['string'] = res['fields'][field]['string'].replace('Hours',time_mode_name) - return res - - def compute_hours(self, cr, uid, ids, context=None): - if context is None: - context = {} - data = self.browse(cr, uid, ids, context=context)[0] - task_id = context.get('active_id') - if task_id: - task_pool = self.pool.get('project.task') - task_pool.write(cr, uid, task_id, {'remaining_hours': data.remaining_hours}) - if context.get('button_reactivate'): - task_pool.do_reopen(cr, uid, [task_id], context=context) - return {'type': 'ir.actions.act_window_close'} - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project/wizard/project_task_reevaluate_view.xml b/addons/project/wizard/project_task_reevaluate_view.xml deleted file mode 100644 index 6dfe58e8cfd..00000000000 --- a/addons/project/wizard/project_task_reevaluate_view.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - - <record id="view_project_task_reevaluate" model="ir.ui.view"> - <field name="name">Re-evaluate Task</field> - <field name="model">project.task.reevaluate</field> - <field name="arch" type="xml"> - <form string="Reevaluate Task" version="7.0"> - <separator string="Reevaluation Task"/> - <group> - <field name="remaining_hours" widget="float_time"/> - </group> - <footer> - <button name="compute_hours" string="_Evaluate" type="object" default_focus="1" class="oe_highlight"/> - or - <button string="Cancel" class="oe_link" special="cancel" /> - </footer> - </form> - </field> - </record> - - <record id="action_project_task_reevaluate" model="ir.actions.act_window"> - <field name="name">Re-evaluate Task</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">project.task.reevaluate</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - </data> -</openerp> |
