diff options
| author | Antony Lesuisse <al@openerp.com> | 2012-06-26 23:06:12 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2012-06-26 23:06:12 +0200 |
| commit | 54ffabf13e4adc8a05afa5fb71e48935459e8630 (patch) | |
| tree | 19d9015107fa1114f1e6068807223742cb0dac4f /addons/document/document.py | |
| parent | 7a96ae2a093613d2324b915e35e5d9ec2c86a358 (diff) | |
| parent | 2e7c2174978e0ef73034453efce5a9a404d0a504 (diff) | |
[MERGE] fix warnings and logging
bzr revid: al@openerp.com-20120626210612-o47a2v6tlb9k4212
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 92ece063a47..fa65f8d9966 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -30,12 +30,15 @@ from tools.translate import _ import nodes import logging +_logger = logging.getLogger(__name__) + DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['root_path'], 'filestore')) class document_file(osv.osv): _inherit = 'ir.attachment' _rec_name = 'datas_fname' - + + def _attach_parent_id(self, cr, uid, ids=None, context=None): """Migrate ir.attachments to the document module. @@ -54,7 +57,7 @@ class document_file(osv.osv): parent_id = self.pool.get('document.directory')._get_root_directory(cr,uid) if not parent_id: - logging.getLogger('document').warning("at _attach_parent_id(), still not able to set the parent!") + _logger.warning("at _attach_parent_id(), still not able to set the parent!") return False if ids is not None: @@ -140,8 +143,8 @@ class document_file(osv.osv): _defaults = { 'user_id': lambda self, cr, uid, ctx:uid, + 'parent_id': __get_def_directory, 'file_size': lambda self, cr, uid, ctx:0, - 'parent_id': __get_def_directory } _sql_constraints = [ # filename_uniq is not possible in pure SQL @@ -336,7 +339,7 @@ class document_file(osv.osv): if r: unres.append(r) else: - logging.getLogger('document').warning("Unlinking attachment #%s %s that has no storage", + self.loggerdoc.warning("Unlinking attachment #%s %s that has no storage", f.id, f.name) res = super(document_file, self).unlink(cr, uid, ids, context) stor.do_unlink(cr, uid, unres) |
