diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index 1d1168e8e3f..cab66157303 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -485,14 +485,37 @@ form
- - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -503,8 +526,9 @@ - - + + + @@ -514,7 +538,7 @@ ir.actions.act_window ir.attachment form - + diff --git a/bin/addons/base/ir/ir_attachment.py b/bin/addons/base/ir/ir_attachment.py index e9b23ff3fa3..ccc07c37781 100644 --- a/bin/addons/base/ir/ir_attachment.py +++ b/bin/addons/base/ir/ir_attachment.py @@ -96,16 +96,29 @@ class ir_attachment(osv.osv): self.pool.get('ir.model.access').unregister_cache_clearing_method(self._name, 'clear_cache') return super(ir_attachment, self).__del__() + def _get_preview(self, cr, uid, ids, name, arg, context=None): + result = {} + for i in self.browse(cr, uid, ids, context=context or {}): + result[i.id] = False + for format in ('png','PNG','jpg','JPG'): + if (i.datas_fname or '').endswith(format): + result[i.id]= i.datas + return result + _name = 'ir.attachment' _columns = { 'name': fields.char('Attachment Name',size=64, required=True), 'datas': fields.binary('Data'), - 'datas_fname': fields.char('Data Filename',size=64), + 'preview': fields.function(_get_preview, type='binary', string='Image Preview', method=True), + 'datas_fname': fields.char('Filename',size=64), 'description': fields.text('Description'), # Not required due to the document module ! 'res_model': fields.char('Resource Object',size=64, readonly=True), 'res_id': fields.integer('Resource ID', readonly=True), - 'link': fields.char('Link', size=256) + 'link': fields.char('Link', size=256), + + 'create_date': fields.datetime('Date Created', readonly=True), + 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), } ir_attachment() diff --git a/bin/addons/base/module/report/ir_module_reference.rml b/bin/addons/base/module/report/ir_module_reference.rml index 156abdba246..a7a25263d81 100644 --- a/bin/addons/base/module/report/ir_module_reference.rml +++ b/bin/addons/base/module/report/ir_module_reference.rml @@ -69,7 +69,7 @@ - + @@ -102,14 +102,14 @@
[[ repeatIn(objects, 'module') ]] - + Module: [[ module.name ]] - +
Name: [[ objdoc(module.shortdesc) ]]
@@ -130,7 +130,7 @@
[[ module.description ]]
[[ repeatIn(findobj(module.name) ,'object') ]] - + Object: [[ object.name ]] @@ -138,7 +138,7 @@ - + [[ repeatIn(findflds(object.model), 'field') ]] [[ field[0] ]] diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 7b7d9867240..0acfba66299 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -359,7 +359,7 @@ class orm_template(object): view_load=%s, select_level=%s, readonly=%s ,required=%s WHERE model=%s AND name=%s""", ( - vals['model_id'], vals['field_description'], vals['ttype'], + vals['model_id'], vals['field_description'], vals['ttype'], vals['relation'], bool(vals['view_load']), vals['select_level'], bool(vals['readonly']),bool(vals['required']), vals['model'], vals['name'] )) @@ -724,7 +724,7 @@ class orm_template(object): if val: val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection', - context.get('lang', False) or 'en_US', val) + context.get('lang', False) or 'en_US', val) sel2.append((key, val2 or val)) sel = sel2 res[f]['selection'] = sel @@ -838,7 +838,7 @@ class orm_template(object): continue ok = True - + if user != 1: # admin user has all roles serv = netsvc.LocalService('object_proxy') user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id'] @@ -2365,13 +2365,12 @@ class orm(orm_template): # records unless they were explicitely asked for if 'active' in self._columns and (active_test and context.get('active_test', True)): if args: - args.insert(0, ('active', '=', 1)) active_in_args = False for a in args: if a[0] == 'active': active_in_args = True if not active_in_args: - args.insert(0, ('active', '=', 1)) + args.insert(0, ('active', '=', 1)) else: args = [('active', '=', 1)]