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
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
@@ -37,7 +37,7 @@
|
||||
<field name="model">document.webdav.dir.property</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Document storage">
|
||||
<search string="Search Document properties">
|
||||
<field name="name" />
|
||||
<field name="namespace" />
|
||||
<newline/>
|
||||
@@ -92,7 +92,68 @@
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- File properties -->
|
||||
<record model="ir.ui.view" id="view_file_props_form">
|
||||
<field name="name">document.webdav.file.property.form</field>
|
||||
<field name="model">document.webdav.file.property</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Properties">
|
||||
<field name="namespace"/>
|
||||
<field name="name"/>
|
||||
<newline />
|
||||
<field name="file_id" />
|
||||
<field name="do_subst" />
|
||||
<newline />
|
||||
<field name="value" colspan="4" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_file_props_tree">
|
||||
<field name="name">document.webdav.file.property.tree</field>
|
||||
<field name="model">document.webdav.file.property</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Properties" toolbar="1">
|
||||
<field name="file_id" />
|
||||
<field name="namespace"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_file_props_filter" model="ir.ui.view">
|
||||
<field name="name">Search View: File DAV properties</field>
|
||||
<field name="model">document.webdav.file.property</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Document properties">
|
||||
<field name="name" />
|
||||
<field name="namespace" />
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." groups="base.group_extended">
|
||||
<filter string="Document" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'file_id'}"/>
|
||||
<filter string="Namespace" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'namespace'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_file_props_form">
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.webdav.file.property</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_file_props_filter"/>
|
||||
</record>
|
||||
<menuitem
|
||||
name="DAV properties for documents"
|
||||
action="action_file_props_form"
|
||||
id="menu_file_props"
|
||||
groups="base.group_no_one"
|
||||
parent="document.menu_document_management_configuration"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user