From 823dc6d50d2a158c0c7428aa09e18a0a0d781a45 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 27 Jun 2010 23:18:18 +0300 Subject: Document directory: cleanup fields, type, constraints. bzr revid: p_christ@hol.gr-20100627201818-wjlumw10u8g28g27 --- addons/document/document_directory.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index fee633b7169..d83d1b6b60e 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -39,16 +39,21 @@ class document_directory(osv.osv): 'write_uid': fields.many2one('res.users', 'Last Modification User', readonly=True), 'create_date': fields.datetime('Date Created', readonly=True), 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), - 'file_type': fields.char('Content Type', size=32), 'domain': fields.char('Domain', size=128, help="Use a domain if you want to apply an automatic filter on visible resources."), 'user_id': fields.many2one('res.users', 'Owner'), 'storage_id': fields.many2one('document.storage', 'Storage'), 'group_ids': fields.many2many('res.groups', 'document_directory_group_rel', 'item_id', 'group_id', 'Groups'), - 'parent_id': fields.many2one('document.directory', 'Parent Item'), + 'parent_id': fields.many2one('document.directory', 'Parent Item', select=1), 'child_ids': fields.one2many('document.directory', 'parent_id', 'Children'), 'file_ids': fields.one2many('ir.attachment', 'parent_id', 'Files'), 'content_ids': fields.one2many('document.directory.content', 'directory_id', 'Virtual Files'), - 'type': fields.selection([('directory','Static Directory'),('ressource','Other Resources')], 'Type', required=True), + 'type': fields.selection([ + ('directory','Static Directory'), + ('ressource','Folders per resource'), + ('at_record','Single folder under resource')], + 'Type', required=True, select=1, + help="Defines directory's behaviour."), + 'ressource_type_id': fields.many2one('ir.model', 'Directories Mapped to Objects', help="Select an object here and Open ERP will create a mapping for each of these " \ "objects, using the given domain, when browsing through FTP."), @@ -60,7 +65,7 @@ class document_directory(osv.osv): 'ressource_tree': fields.boolean('Tree Structure', help="Check this if you want to use the same tree structure as the object selected in the system."), 'dctx_ids': fields.one2many('document.directory.dctx', 'dir_id', 'Context fields'), - 'company_id': fields.many2one('res.company', 'Company'), + 'company_id': fields.many2one('res.company', 'Company'), } @@ -102,7 +107,8 @@ class document_directory(osv.osv): } _sql_constraints = [ ('dirname_uniq', 'unique (name,parent_id,ressource_id,ressource_parent_type_id)', 'The directory name must be unique !'), - ('no_selfparent', 'check(parent_id <> id)', 'Directory cannot be parent of itself!') + ('no_selfparent', 'check(parent_id <> id)', 'Directory cannot be parent of itself!'), + ('dir_parented', 'check(parent_id IS NOT NULL OR storage_id IS NOT NULL)', 'Directory must have a parent or a storage') ] def name_get(self, cr, uid, ids, context={}): res = [] -- cgit v1.2.3 From 07d395df15c22037d64f0d7dceeec4d1328ce999 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 27 Jun 2010 23:18:26 +0300 Subject: Document: cleanup the view (and help) of directory. bzr revid: p_christ@hol.gr-20100627201826-1873sa0et2q8vx62 --- addons/document/document_directory.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index d83d1b6b60e..2872491129d 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -54,9 +54,8 @@ class document_directory(osv.osv): 'Type', required=True, select=1, help="Defines directory's behaviour."), - 'ressource_type_id': fields.many2one('ir.model', 'Directories Mapped to Objects', - help="Select an object here and Open ERP will create a mapping for each of these " \ - "objects, using the given domain, when browsing through FTP."), + 'ressource_type_id': fields.many2one('ir.model', 'Resource model', + help="Select an object here and there will be one folder per record of that resource."), 'resource_field': fields.many2one('ir.model.fields', 'Name field', help='Field to be used as name on resource directories. If empty, the "name" will be used.'), 'ressource_parent_type_id': fields.many2one('ir.model', 'Parent Model', help="If you put an object here, this directory template will appear bellow all of these objects. " \ -- cgit v1.2.3 From e068962cca72f8936f34e2f81555ef93214e05fc Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 29 Jun 2010 17:00:29 +0300 Subject: Document UI: rename the parent_id of a dir . bzr revid: p_christ@hol.gr-20100629140029-fnx876jkkezchc3j --- addons/document/document_directory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 2872491129d..a464ca61247 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -43,7 +43,7 @@ class document_directory(osv.osv): 'user_id': fields.many2one('res.users', 'Owner'), 'storage_id': fields.many2one('document.storage', 'Storage'), 'group_ids': fields.many2many('res.groups', 'document_directory_group_rel', 'item_id', 'group_id', 'Groups'), - 'parent_id': fields.many2one('document.directory', 'Parent Item', select=1), + 'parent_id': fields.many2one('document.directory', 'Parent Directory', select=1), 'child_ids': fields.one2many('document.directory', 'parent_id', 'Children'), 'file_ids': fields.one2many('ir.attachment', 'parent_id', 'Files'), 'content_ids': fields.one2many('document.directory.content', 'directory_id', 'Virtual Files'), -- cgit v1.2.3 From 74d60c861f8a8ea7bc04a1dd135db699a94bdbc3 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 29 Jun 2010 17:05:19 +0300 Subject: Document: the node context shouldn't contain 'lang' Node context should be as neutral as possible, in order to help caching. bzr revid: p_christ@hol.gr-20100629140519-fgxcr2wm5ctg8ywl --- addons/document/document_directory.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index a464ca61247..1b62418106c 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -195,17 +195,8 @@ class document_directory(osv.osv): """ if not context: context = {} - lang = context.get('lang',False) - if not lang: - user = self.pool.get('res.users').browse(cr, uid, uid) - lang = user.context_lang - context['lang'] = lang - try: #just instrumentation - return nodes.get_node_context(cr, uid, context).get_uri(cr, uri) - except Exception,e: - print "exception: ",e - raise + return nodes.get_node_context(cr, uid, context).get_uri(cr, uri) def _locate_child(self, cr, uid, root_id, uri,nparent, ncontext): -- cgit v1.2.3 From 03865bc917b6fa7ee3e3964411722ccdc75b52c2 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Fri, 9 Jul 2010 01:50:42 +0300 Subject: Document: Less dir, storage options, cleanup views. The 'virtual' storage is now hidden. An extra 'db64' type, hidden, is supported in the code, for v5-compatible databases (until we migrate the db_datas column of them). The 'at_record' directory type is gone. A module in extra-addons will permit the compatible behaviour, for those experts. bzr revid: p_christ@hol.gr-20100708225042-fp3zcwmw4zp3ee04 --- addons/document/document_directory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 1b62418106c..9913946eee4 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -50,7 +50,7 @@ class document_directory(osv.osv): 'type': fields.selection([ ('directory','Static Directory'), ('ressource','Folders per resource'), - ('at_record','Single folder under resource')], + ], 'Type', required=True, select=1, help="Defines directory's behaviour."), -- cgit v1.2.3 From 0d6e0a9a0286a0b240e77f47f3b8b36aaaa2b1b9 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Fri, 9 Jul 2010 11:23:16 +0300 Subject: Document: support Moving of files. bzr revid: p_christ@hol.gr-20100709082316-d8qedrjabckypt88 --- addons/document/document_directory.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/document/document_directory.py') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 9913946eee4..4d1079d6be9 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -270,6 +270,8 @@ class document_directory(osv.osv): raise osv.except_osv(_('ValidateError'), _('Directory name contains special characters!')) return super(document_directory,self).create(cr, uid, vals, context) + # TODO def unlink(... + document_directory() class document_directory_dctx(osv.osv): -- cgit v1.2.3