summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-07-13 23:53:59 +0300
committerP. Christeas <p_christ@hol.gr>2010-07-13 23:53:59 +0300
commit766fd336d4f8f0e17a05741542bf0a6e440e06bc (patch)
treeaf65a3559e7dc818ac2e74a6dbbf2a3db0128d3a /addons/document/document.py
parentd3ae0b008347718cec73df4523da0b674e2ba830 (diff)
Document: fix realstore with open/close, rename.
Put the path computation of realstore in a helper function, and use that in all places where a file is opened/created/moved. bzr revid: p_christ@hol.gr-20100713205359-jn0bo6fcw9lwdyge
Diffstat (limited to 'addons/document/document.py')
-rw-r--r--addons/document/document.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index ac3d7b9187d..46d0981cc69 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -157,7 +157,10 @@ class document_file(osv.osv):
return False
if not self._check_duplication(cr, uid, vals, ids, 'write'):
raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
- if ('parent_id' in vals) or ('name' in vals):
+
+ # if nodes call this write(), they must skip the code below
+ from_node = context and context.get('__from_node', False)
+ if (('parent_id' in vals) or ('name' in vals)) and not from_node:
# perhaps this file is renaming or changing directory
nctx = nodes.get_node_context(cr,uid,context={})
dirobj = self.pool.get('document.directory')