From 19cbbf0832061dcd1c0b92caa009282b110ea3e5 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:39:55 +0200 Subject: [PATCH] doc webdav: DAV properties for files (ir.attachment), used for locking Similar to the dir.property model, ir.attachments may have arbitrary properties, too. Note that we hide them from normal users, only list them in separate form (don't want to bloat the ir.attachment one, even at the XML level). bzr revid: p_christ@hol.gr-20101207133955-8n6ipccdnygnuncn --- addons/document_webdav/document_webdav.py | 34 ++++++++++ .../security/ir.model.access.csv | 1 + addons/document_webdav/webdav_view.xml | 63 ++++++++++++++++++- 3 files changed, 97 insertions(+), 1 deletion(-) diff --git a/addons/document_webdav/document_webdav.py b/addons/document_webdav/document_webdav.py index 2e1eb8cabd2..aa14bc239bb 100644 --- a/addons/document_webdav/document_webdav.py +++ b/addons/document_webdav/document_webdav.py @@ -80,6 +80,10 @@ class dav_dir_property(osv.osv): _name = 'document.webdav.dir.property' _columns = { + 'create_date': fields.datetime('Date Created', readonly=True), + 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), + 'write_date': fields.datetime('Date Modified', readonly=True), + 'write_uid': fields.many2one('res.users', 'Last Modification User', readonly=True), 'dir_id': fields.many2one('document.directory', 'Directory', required=False, select=1), 'namespace': fields.char('Namespace', size=127, required=True), 'name': fields.char('Name', size=64, required=True), @@ -93,4 +97,34 @@ class dav_dir_property(osv.osv): dav_dir_property() +class dav_file_property(osv.osv): + """ Arbitrary WebDAV properties, attached to ir.attachments. + + A special case is the locks that can be applied on file nodes. + + There _can_ be properties without a file (RFC?), which means that they + globally apply to all the attachments of the present database. + + TODO access permissions, per property. + """ + _name = 'document.webdav.file.property' + + _columns = { + 'create_date': fields.datetime('Date Created', readonly=True), + 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), + 'write_date': fields.datetime('Date Modified', readonly=True), + 'write_uid': fields.many2one('res.users', 'Last Modification User', readonly=True), + 'file_id': fields.many2one('ir.attachment', 'Document', required=False, select=1), + 'namespace': fields.char('Namespace', size=127, required=True), + 'name': fields.char('Name', size=64, required=True), + 'value': fields.text('Value'), + 'do_subst': fields.boolean('Substitute', required=True), + } + + _defaults = { + 'do_subst': False, + } + +dav_file_property() + #eof \ No newline at end of file diff --git a/addons/document_webdav/security/ir.model.access.csv b/addons/document_webdav/security/ir.model.access.csv index a77304eb297..987f7a4f90a 100644 --- a/addons/document_webdav/security/ir.model.access.csv +++ b/addons/document_webdav/security/ir.model.access.csv @@ -2,3 +2,4 @@ "access_webdav_dir_property_all","webdav.dir.property all","model_document_webdav_dir_property",,1,0,0,0 "access_webdav_dir_property_group_doc_manager","webdav.dir.property document manager","model_document_webdav_dir_property","base.group_system",1,1,1,1 "access_webdav_dir_property_group_system","webdav.dir.property group system","model_document_webdav_dir_property","base.group_system",1,1,1,1 +"access_webdav_file_property_all","webdav.file.property all","model_document_webdav_file_property",,1,1,1,1 diff --git a/addons/document_webdav/webdav_view.xml b/addons/document_webdav/webdav_view.xml index 2ea0bca5279..4e76346469a 100644 --- a/addons/document_webdav/webdav_view.xml +++ b/addons/document_webdav/webdav_view.xml @@ -37,7 +37,7 @@ document.webdav.dir.property search - + @@ -92,7 +92,68 @@ + + + + document.webdav.file.property.form + document.webdav.file.property + form + +
+ + + + + + + + + +
+ + document.webdav.file.property.tree + document.webdav.file.property + tree + + + + + + + + + + + Search View: File DAV properties + document.webdav.file.property + search + + + + + + + + + + + + + + + ir.actions.act_window + document.webdav.file.property + form + tree,form + + +