[fix] complex bug in BufferedDataSet
[odoo/odoo.git] / addons / project_long_term / project_long_term.py
index b6647b6..612bd78 100644 (file)
@@ -22,7 +22,7 @@
 from datetime import datetime
 from tools.translate import _
 from osv import fields, osv
-from resource.faces import task as Task
+from openerp.addons.resource.faces import task as Task
 
 class project_phase(osv.osv):
     _name = "project.phase"
@@ -72,13 +72,7 @@ class project_phase(osv.osv):
              if phase['date_start'] and phase['date_end'] and phase['date_start'] > phase['date_end']:
                  return False
          return True
-    #dead code
-    def _get_default_uom_id(self, cr, uid):
-       model_data_obj = self.pool.get('ir.model.data')
-       model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour')
-       return model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
 
-    #dead code
     def _compute_progress(self, cr, uid, ids, field_name, arg, context=None):
         res = {}
         if not ids:
@@ -107,14 +101,14 @@ class project_phase(osv.osv):
 
     _columns = {
         'name': fields.char("Name", size=64, required=True),
-        'date_start': fields.datetime('Start Date', help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
+        'date_start': fields.datetime('Start Date', select=True, help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
         'date_end': fields.datetime('End Date', help=" It's computed by the scheduler according to the start date and the duration.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
         'constraint_date_start': fields.datetime('Minimum Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
         'constraint_date_end': fields.datetime('Deadline', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
-        'project_id': fields.many2one('project.project', 'Project', required=True),
+        'project_id': fields.many2one('project.project', 'Project', required=True, select=True),
         'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases', states={'cancelled':[('readonly',True)]}),
         'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases', states={'cancelled':[('readonly',True)]}),
-        'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of phases."),
+        'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of phases."),
         'duration': fields.float('Duration', required=True, help="By default in days", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
         'product_uom': fields.many2one('product.uom', 'Duration UoM', required=True, help="UoM (Unit of Measure) is the unit of measurement for Duration", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
         'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@@ -180,7 +174,7 @@ class project_phase(osv.osv):
                 'months': 'm', 'month':'month', 'm':'m',
                 'weeks': 'w', 'week': 'w', 'w':'w',
                 'hours': 'H', 'hour': 'H', 'h':'H',
-            }.get(phase.product_uom.name.lower(), "h")
+            }.get(phase.product_uom.name.lower(), "H")
             duration = str(phase.duration) + duration_uom
             result += '''
     def Phase_%s():