[IMP]: document: [task-786] Review ir_attachment object,apply changes in base/ir and document module
bzr revid: ksa@tinyerp.co.in-20100527111423-m2b3wrx02jcuxvy9
This commit is contained in:
parent
b3c7cc9035
commit
51770be47b
|
@ -88,12 +88,11 @@ class document_file(osv.osv):
|
|||
'create_uid': fields.many2one('res.users', 'Creator', readonly=True),
|
||||
'store_method': fields.selection([('db', 'Database'), ('fs', 'Filesystem'), ('link', 'Link')], "Storing Method"),
|
||||
'datas': fields.function(_data_get, method=True, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True),
|
||||
'url': fields.char('File URL',size=64),
|
||||
'store_fname': fields.char('Stored Filename', size=200),
|
||||
'res_model': fields.char('Attached Model', size=64), #res_model
|
||||
'res_id': fields.integer('Attached ID'), #res_id
|
||||
# 'res_name': fields.function(_name_get_resname, type='char', string='Resource Name', method=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', select=1),
|
||||
'title': fields.char('Resource Title', size=64),
|
||||
'type':fields.selection([
|
||||
('url','URL'),
|
||||
('binary','Binary'),
|
||||
|
@ -161,7 +160,6 @@ class document_file(osv.osv):
|
|||
def create(self, cr, uid, vals, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
vals['title'] = vals['name']
|
||||
vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
|
||||
if not vals['parent_id']:
|
||||
vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context)
|
||||
|
@ -174,8 +172,6 @@ class document_file(osv.osv):
|
|||
result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context)
|
||||
if len(result):
|
||||
obj = result[0]
|
||||
if obj.get('name', False):
|
||||
vals['title'] = (obj.get('name', ''))[:60]
|
||||
if obj_model._name == 'res.partner':
|
||||
vals['partner_id'] = obj['id']
|
||||
elif obj.get('address_id', False):
|
||||
|
|
|
@ -179,27 +179,31 @@
|
|||
<form string="Documents">
|
||||
<group colspan="4" col="6">
|
||||
<field name="name" select="1" />
|
||||
<field name="title" select="1"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="type"/>
|
||||
<field name="parent_id"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Attachment">
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Data" colspan="2"/>
|
||||
<group col="2" colspan="2" attrs="{'invisible':[('type','=','url')]}">
|
||||
<field name="datas" filename="datas_fname"/>
|
||||
<field name="datas_fname" select="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="2" 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" readonly="1"/>
|
||||
<field name="res_id" readonly="1"/>
|
||||
<separator string="Relation" colspan="2"/>
|
||||
<field name="res_name" readonly="1"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<group col="4" colspan="4">
|
||||
<separator string="File Information" colspan="4"/>
|
||||
<field name="file_size" readonly="1"/>
|
||||
<newline/>
|
||||
<separator string="History" colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<field name="create_uid"/>
|
||||
|
@ -210,15 +214,6 @@
|
|||
<field name="write_date"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Preview" colspan="4"/>
|
||||
<field
|
||||
name="preview"
|
||||
widget="image"
|
||||
readonly="1"
|
||||
nolabel="1"
|
||||
colspan="4"
|
||||
img_height="400"
|
||||
img_width="800"/>
|
||||
|
||||
</page>
|
||||
<page string="Security">
|
||||
|
@ -239,24 +234,23 @@
|
|||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="IR Attachment">
|
||||
<filter icon="gtk-media-rewind" string="Recent"
|
||||
help="less 1 month modified/created attachments"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')),('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=', False)]"
|
||||
help="Filter on my Attachment" />
|
||||
</field>
|
||||
<field name="partner_id" widget="selection"/>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]"
|
||||
context="{'group_by':'partner_id'}" />
|
||||
<filter string="Directory" icon="gtk-open" domain="[]" context="{'group_by':'parent_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=', False)]"
|
||||
help="Owner" />
|
||||
</field>
|
||||
<field name="partner_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('partner_id','=', False)]"
|
||||
help="Partner"/>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -266,15 +260,15 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="priority" eval="1"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Documents">
|
||||
<tree colors="blue:type in ('url')" string="Documents">
|
||||
<field name="name"/>
|
||||
<field name="title" />
|
||||
<field name="partner_id"/>
|
||||
<field name="type"/>
|
||||
<field name="datas_fname"/>
|
||||
<field name="user_id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
</tree>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ class report_document_user(osv.osv):
|
|||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
|
||||
'user_id':fields.integer('Owner', readonly=True),
|
||||
'user':fields.char('User',size=64,readonly=True),
|
||||
'file_title': fields.char('File Name',size=64,readonly=True),
|
||||
'directory': fields.char('Directory',size=64,readonly=True),
|
||||
'create_date': fields.datetime('Date Created', readonly=True),
|
||||
'change_date': fields.datetime('Modified Date', readonly=True),
|
||||
|
@ -66,7 +65,6 @@ class report_document_user(osv.osv):
|
|||
d.name as directory,
|
||||
f.create_date as create_date,
|
||||
f.file_size as file_size,
|
||||
min(f.title) as file_title,
|
||||
min(d.type) as type,
|
||||
f.write_date as change_date
|
||||
from ir_attachment f
|
||||
|
@ -83,7 +81,6 @@ class report_files_partner(osv.osv):
|
|||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year',size=64,required=False, readonly=True),
|
||||
'file_title': fields.char('File Name',size=64,readonly=True),
|
||||
'directory': fields.char('Directory',size=64,readonly=True),
|
||||
'create_date': fields.datetime('Date Created', readonly=True),
|
||||
'change_date': fields.datetime('Modified Date', readonly=True),
|
||||
|
@ -101,7 +98,6 @@ class report_files_partner(osv.osv):
|
|||
select min(f.id) as id,count(*) as nbr,
|
||||
to_char(f.create_date,'YYYY') as name,
|
||||
min(to_char(f.create_date,'MM')) as month,
|
||||
min(f.title) as file_title,
|
||||
p.name as partner
|
||||
from ir_attachment f
|
||||
inner join res_partner p
|
||||
|
@ -145,7 +141,6 @@ class report_document_wall(osv.osv):
|
|||
'user_id':fields.many2one('res.users', 'Owner',readonly=True),
|
||||
'user':fields.char('User',size=64,readonly=True),
|
||||
'month': fields.char('Month', size=24,readonly=True),
|
||||
'file_name':fields.char('Last Posted File Name',size=64,readonly=True),
|
||||
'last':fields.datetime('Last Posted Time', readonly=True),
|
||||
}
|
||||
|
||||
|
@ -153,7 +148,6 @@ class report_document_wall(osv.osv):
|
|||
cr.execute("""
|
||||
create or replace view report_document_wall as (
|
||||
select max(f.id) as id,
|
||||
min(title) as file_name,
|
||||
to_char(min(f.create_date),'YYYY-MM-DD HH24:MI:SS') as last,
|
||||
f.user_id as user_id, f.user_id as user,
|
||||
to_char(f.create_date,'Month') as month
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Files">
|
||||
<field name="name" select="1"/>
|
||||
<field name="file_title" select="1"/>
|
||||
<field name="user" select="1"/>
|
||||
<field name="directory" select="1"/>
|
||||
<field name="file_size"/>
|
||||
|
@ -26,7 +25,6 @@
|
|||
<tree string="Files">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="file_title"/>
|
||||
<field name="user" select="1"/>
|
||||
<field name="directory" select="1"/>
|
||||
<field name="file_size"/>
|
||||
|
@ -48,7 +46,6 @@
|
|||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="file_title" select="1"/>
|
||||
<field name="user" select="1"/>
|
||||
<field name="directory" select="1"/>
|
||||
</group>
|
||||
|
@ -79,13 +76,11 @@
|
|||
<form string="Wall of Shame">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="file_name" select="1"/>
|
||||
<field name="last"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_document_wall_tree">
|
||||
<field name="name">report.document.wall.tree</field>
|
||||
<field name="model">report.document.wall</field>
|
||||
|
@ -94,7 +89,6 @@
|
|||
<tree string="Wall of Shame">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="file_name"/>
|
||||
<field name="last"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue