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
This commit is contained in:
@@ -655,27 +655,37 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Attachments">
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="2">
|
||||
<field name="name" select="1" />
|
||||
<field name="create_uid" select="2"/>
|
||||
<field name="create_date" select="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Attachment">
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Data" colspan="2"/>
|
||||
<group col="4" colspan="4">
|
||||
<separator string="Data" colspan="2"/>
|
||||
<field name="type"/>
|
||||
<newline />
|
||||
<group col="2" colspan="4" attrs="{'invisible':[('type','=','url')]}">
|
||||
<field name="datas" filename="datas_fname"/>
|
||||
<field name="datas_fname" select="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="4" attrs="{'invisible':[('type','=','binary')]}">
|
||||
<field name="url" widget="url"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Attached To" colspan="2"/>
|
||||
<field name="res_model" select="2"/>
|
||||
<field name="res_id"/>
|
||||
<field name="res_name"/>
|
||||
</group>
|
||||
<group col="2" groups="base.group_extended">
|
||||
<separator string="Created" colspan="2"/>
|
||||
<field name="create_uid" select="2"/>
|
||||
<field name="create_date" select="2"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="description" nolabel="1"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user