summaryrefslogtreecommitdiff
path: root/addons/document_webdav/document_webdav.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-10-12 13:38:58 +0300
committerP. Christeas <p_christ@hol.gr>2010-10-12 13:38:58 +0300
commitc52b73b587971da28020c47dcb5395a82e2b20ea (patch)
treeaf21b213d95496ab09d7ff8e211ca0f8c9130863 /addons/document_webdav/document_webdav.py
parent402d407b2c3f630ca57d31f72b48ed397fec1119 (diff)
doc webdav: initial override of nodes.py
bzr revid: p_christ@hol.gr-20101012103858-hykw2g2ezbwaobmn
Diffstat (limited to 'addons/document_webdav/document_webdav.py')
-rw-r--r--addons/document_webdav/document_webdav.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/addons/document_webdav/document_webdav.py b/addons/document_webdav/document_webdav.py
new file mode 100644
index 00000000000..2db183e4ec6
--- /dev/null
+++ b/addons/document_webdav/document_webdav.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 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 osv import osv, fields
+import nodes
+
+class document_davdir(osv.osv):
+ _inherit = 'document.directory'
+
+ def get_node_class(self, cr, uid, ids, dbro=None, context=None):
+ # Note: in this function, nodes come from document_webdav/nodes.py !
+ if dbro is None:
+ dbro = self.browse(cr, uid, ids, context=context)
+
+ if dbro.type == 'directory':
+ return nodes.node_dir
+ elif dbro.type == 'ressource':
+ assert not dbro.ressource_parent_type_id, \
+ "resource and parent_id at #%d: %r" % (dbro.id, dbro.ressource_parent_type_id)
+ return nodes.node_res_dir
+ else:
+ raise ValueError("dir node for %s type", dbro.type)
+
+ def _prepare_context(self, cr, uid, nctx, context):
+ nctx.node_file_class = nodes.node_file
+ return
+
+document_davdir()
+#eof \ No newline at end of file