[MERGE]
authorHarry (OpenERP) <hmo@tinyerp.com>
Thu, 11 Nov 2010 13:30:06 +0000 (19:00 +0530)
committerHarry (OpenERP) <hmo@tinyerp.com>
Thu, 11 Nov 2010 13:30:06 +0000 (19:00 +0530)
bzr revid: hmo@tinyerp.com-20101111133006-qzqtz3grocgewap4

1  2 
addons/base_calendar/base_calendar.py
addons/document/document.py
addons/project_caldav/project_caldav.py

@@@ -399,7 -399,7 +399,7 @@@ property or property parameter.")
          res = None
          def ics_datetime(idate, short=False):
              if idate:
--                if short:
++                if short or len(idate)<=10:
                      return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d')))
                  else:
                      return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
@@@ -245,7 -245,7 +245,7 @@@ class document_file(osv.osv)
          # files to be unlinked, update the db (safer to do first, can be
          # rolled back) and then unlink the files. The list wouldn't exist
          # after we discard the objects
--
++        ids = self.search(cr, uid, [('id','in',ids)])
          for f in self.browse(cr, uid, ids, context):
              # TODO: update the node cache
              par = f.parent_id
@@@ -45,6 -46,50 +46,41 @@@ class project_task(osv.osv)
          'state': 'draft',
      }
  
+     def open_task(self, cr, uid, ids, context=None):
+         """
+         Open Task Form for Project Task.
+         @param cr: the current row, from the database cursor,
+         @param uid: the current user’s ID for security checks,
+         @param ids: List of project task’s IDs
+         @param context: A standard dictionary for contextual values
+         @return: Dictionary value which open Project Task form.
+         """
+         if not context:
+             context = {}
 -        data_obj = self.pool.get('ir.model.data')
 -
++        data_pool = self.pool.get('ir.model.data')
+         value = {}
 -
 -        task_form_ids = data_obj._get_id(cr, uid, 'project', 'view_task_form2')
 -        task_tree_ids = data_obj._get_id(cr, uid, 'project', 'view_task_tree2')
 -        task_calendar_ids = data_obj._get_id(cr, uid, 'project', 'view_task_calendar')
 -        
 -        if task_form_ids:
 -            task_form_id = data_obj.browse(cr, uid, task_form_ids, context=context).res_id
 -        if task_tree_ids:
 -            task_tree_id = data_obj.browse(cr, uid, task_tree_ids, context=context).res_id
 -        if task_calendar_ids:
 -            task_calendar_id = data_obj.browse(cr, uid, task_calendar_ids, context=context).res_id
++        task_form_id = data_pool.get_object(cr, uid, 'project', 'view_task_form2')
++        task_tree_id = data_pool.get_object(cr, uid, 'project', 'view_task_tree2')
++        task_calendar_id = data_pool.get_object(cr, uid, 'project', 'view_task_calendar')
+         for id in ids:
+             value = {
+                     'name': _('Tasks'),
+                     'view_type': 'form',
+                     'view_mode': 'form,tree',
+                     'res_model': 'project.task',
+                     'view_id': False,
+                     'views': [(task_form_id, 'form'), (task_tree_id, 'tree'), (task_calendar_id, 'calendar')],
+                     'type': 'ir.actions.act_window',
+                     'res_id': base_calendar.base_calendar_id2real_id(id),
+                     'nodestroy': True
+                     }
+         return value
      def import_cal(self, cr, uid, data, data_id=None, context=None):
          todo_obj = self.pool.get('basic.calendar.todo')
          vals = todo_obj.import_cal(cr, uid, data, context=context)