[FIX] dms: if file does not has any direcotry on creation, take root directory
authorHarry (Open ERP) <hmo@tinyerp.com>
Thu, 18 Mar 2010 15:30:43 +0000 (21:00 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Thu, 18 Mar 2010 15:30:43 +0000 (21:00 +0530)
bzr revid: hmo@tinyerp.com-20100318153043-32ict1bcx08pe704

addons/document/document.py

index 375f24c..f3ffd2f 100644 (file)
@@ -157,6 +157,8 @@ class document_file(osv.osv):
             context = {}
         vals['title'] = vals['name']
         vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
+        if not vals['parent_id']:
+            vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context)
         if not vals.get('res_id', False) and context.get('default_res_id', False):
             vals['res_id'] = context.get('default_res_id', False)
         if not vals.get('res_model', False) and context.get('default_res_model', False):