From cb97a6dbdfcc15717299f1bd6a73bcfde88234c6 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 27 Jun 2010 22:59:48 +0300 Subject: [PATCH] ir.attachment: refactor columns, UI view. This also brings in the necessary fields for url mode, which must work without the document module. bzr revid: p_christ@hol.gr-20100627195948-f8yc07bhux50x9jl --- bin/addons/base/ir/ir.xml | 22 ++++++++++++++++------ bin/addons/base/ir/ir_attachment.py | 24 +++++++++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index d5be9539a0a..215240170a0 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -655,27 +655,37 @@ form
- + - - - - + + + + + + + + + + + + + + - + diff --git a/bin/addons/base/ir/ir_attachment.py b/bin/addons/base/ir/ir_attachment.py index 981c6091ceb..ba93c95fc14 100644 --- a/bin/addons/base/ir/ir_attachment.py +++ b/bin/addons/base/ir/ir_attachment.py @@ -101,18 +101,28 @@ class ir_attachment(osv.osv): _name = 'ir.attachment' _columns = { - 'name': fields.char('Attachment Name',size=64, required=True), + 'name': fields.char('Attachment Name',size=256, required=True), 'datas': fields.binary('Data'), - 'datas_fname': fields.char('Filename',size=64), + 'datas_fname': fields.char('Filename',size=256), 'description': fields.text('Description'), - # Not required due to the document module ! - 'res_name': fields.function(_name_get_resname, type='char', string='Resource Name', method=True), - 'res_model': fields.char('Resource Object',size=64, readonly=True), - 'res_id': fields.integer('Resource ID', readonly=True), - 'link': fields.char('Link', size=256), + 'res_name': fields.function(_name_get_resname, type='char', + string='Resource Name', method=True), + 'res_model': fields.char('Resource Object',size=64, readonly=True, + help="The database object this attachment will be attached to"), + 'res_id': fields.integer('Resource ID', readonly=True, + help="The record id this is attached to"), + 'url': fields.char('Url', size=512, oldname="link"), + 'type': fields.selection( + [ ('url','URL'), ('binary','Binary'), ], + 'Type', help="Binary File or external URL", required=True), + 'create_date': fields.datetime('Date Created', readonly=True), 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), } + + _defaults = { + 'type': 'binary', + } ir_attachment()