[IMP] ::Documents->Shared Repository:enlarge the FTP server field,Documents-> descending by date and tooltip change and fix bug on my document filter button::Reporting->Document Dashboard->group by year/Month and default user_id context remove

bzr revid: ron@tinyerp.com-20101012062608-nvlyu9qag6zeyh5h
This commit is contained in:
ron@tinyerp.com 2010-10-12 11:56:08 +05:30
parent 635e3389e9
commit e848ed0cf4
11 changed files with 41 additions and 47 deletions

View File

@ -16,9 +16,7 @@
<action
string="New Files"
name="%(document.action_view_all_document_tree1)d"
view_mode="tree"
domain="[('name','=',time.strftime('%%Y')),('month','=',time.strftime('%%m'))]"/>
view_mode="tree,form"/>
<action
string="File Size by Month"
name="%(document.action_view_size_month)d"
@ -28,7 +26,7 @@
<action
string="Files by Resource Type"
name="%(document.action_view_document_by_resourcetype_graph)d"
view_mode="graph,tree"/>
/>
<action
string="Files by Partner"

View File

@ -41,7 +41,7 @@ class document_file(osv.osv):
fbrl = self.browse(cr, uid, ids, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
# nctx will /not/ inherit the caller's context. Most of
# it would be useless, anyway (like active_id, active_model,
# it would be useless, anyway (like active_id, active_model,
# bin_size etc.)
result = {}
bin_size = context.get('bin_size', False)
@ -91,10 +91,11 @@ class document_file(osv.osv):
'company_id': fields.many2one('res.company', 'Company'),
'file_size': fields.integer('File Size', required=True),
'file_type': fields.char('Content Type', size=128),
# fields used for file storage
'store_fname': fields.char('Stored Filename', size=200),
}
_order = "create_date desc"
def __get_def_directory(self, cr, uid, context=None):
dirobj = self.pool.get('document.directory')
@ -150,7 +151,7 @@ class document_file(osv.osv):
return False
if not self._check_duplication(cr, uid, vals, ids, 'write'):
raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
# if nodes call this write(), they must skip the code below
from_node = context and context.get('__from_node', False)
if (('parent_id' in vals) or ('name' in vals)) and not from_node:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -44,13 +44,13 @@ class document_directory(osv.osv):
'child_ids': fields.one2many('document.directory', 'parent_id', 'Children'),
'file_ids': fields.one2many('ir.attachment', 'parent_id', 'Files'),
'content_ids': fields.one2many('document.directory.content', 'directory_id', 'Virtual Files'),
'type': fields.selection([
'type': fields.selection([
('directory','Static Directory'),
('ressource','Folders per resource'),
],
'Type', required=True, select=1,
help="Defines directory's behaviour."),
'ressource_type_id': fields.many2one('ir.model', 'Resource model',
help="Select an object here and there will be one folder per record of that resource."),
'resource_field': fields.many2one('ir.model.fields', 'Name field', help='Field to be used as name on resource directories. If empty, the "name" will be used.'),
@ -95,13 +95,13 @@ class document_directory(osv.osv):
return objid.browse(cr, uid, mid, context=context).res_id
except Exception:
return None
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'document.directory', context=c),
'user_id': lambda self,cr,uid,ctx: uid,
'domain': lambda self,cr,uid,ctx: '[]',
'type': lambda *args: 'directory',
'ressource_id': lambda *a: 0,
'ressource_id': lambda *a: 0,
'storage_id': _get_def_storage,
'resource_find_all': True,
}
@ -151,7 +151,7 @@ class document_directory(osv.osv):
_constraints = [
(_check_recursion, 'Error! You can not create recursive Directories.', ['parent_id'])
]
def __init__(self, *args, **kwargs):
super(document_directory, self).__init__(*args, **kwargs)
@ -172,7 +172,7 @@ class document_directory(osv.osv):
"""
if not context:
context = {}
return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
def get_dir_permissions(self, cr, uid, ids ):
@ -180,7 +180,7 @@ class document_directory(osv.osv):
"""
assert len(ids) == 1
id = ids[0]
cr.execute( "SELECT count(dg.item_id) AS needs, count(ug.uid) AS has " \
" FROM document_directory_group_rel dg " \
" LEFT OUTER JOIN res_groups_users_rel ug " \
@ -197,7 +197,7 @@ class document_directory(osv.osv):
Return a tuple (node_dir, remaining_path)
"""
return (nodes.node_database(context=ncontext), uri)
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default ={}

View File

@ -291,7 +291,7 @@
<field name="parent_id" />
<field name="user_id">
<filter icon="terp-personal"
domain="[('user_id','=', False)]"
domain="[('user_id','=',uid)]"
help="Filter on my documents" />
</field>
<field name="partner_id"/>
@ -333,7 +333,7 @@
<field name="res_model">ir.attachment</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="view_attach_filter"/>
<field name="help">Documents give your access to all attached documents; it's a repository of all attached documents (mails, documents attached to a project, etc.)</field>
<field name="help">The Documents repository gives you access to all attachments, such as mails, project documents, invoices etc.</field>
</record>
<menuitem name="Documents" id="menu_document_doc" parent="knowledge.menu_document" sequence="0"/>
<menuitem
@ -403,7 +403,7 @@
src_model="res.partner"
groups="base.group_extended"/>
<act_window
<act_window
context="{'search_default_parent_id': [active_id]}"
id="zoom_directory" name="Related Documents"
res_model="ir.attachment"

View File

@ -34,6 +34,7 @@ class report_document_user(osv.osv):
'user_id':fields.integer('Owner', readonly=True),
'user':fields.char('User',size=64,readonly=True),
'directory': fields.char('Directory',size=64,readonly=True),
'datas_fname': fields.char('File Name',size=64,readonly=True),
'create_date': fields.datetime('Date Created', readonly=True),
'change_date': fields.datetime('Modified Date', readonly=True),
'file_size': fields.integer('File Size', readonly=True),
@ -52,6 +53,7 @@ class report_document_user(osv.osv):
u.name as user,
count(*) as nbr,
d.name as directory,
f.datas_fname as datas_fname,
f.create_date as create_date,
f.file_size as file_size,
min(d.type) as type,
@ -59,11 +61,13 @@ class report_document_user(osv.osv):
FROM ir_attachment f
left join document_directory d on (f.parent_id=d.id and d.name<>'')
inner join res_users u on (f.user_id=u.id)
group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date
group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date,f.datas_fname
)
""")
report_document_user()
class report_files_partner(osv.osv):
_name = "report.files.partner"
_description = "Files details by Partners"
@ -86,7 +90,7 @@ class report_files_partner(osv.osv):
to_char(date_trunc('month', f.create_date),'MM') AS month,
SUM(f.file_size) AS file_size,
p.name AS partner
FROM ir_attachment f
LEFT JOIN res_partner p ON (f.partner_id=p.id)
WHERE f.datas_fname IS NOT NULL

View File

@ -10,6 +10,7 @@
<field name="name" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="datas_fname" select="1"/>
<field name="file_size"/>
<field name="create_date"/>
</form>
@ -25,10 +26,11 @@
<tree string="Files">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="file_size"/>
<field name="create_date"/>
<field name="user" select="1" invisible="1"/>
<field name="directory" select="1" invisible="1"/>
<field name="file_size" invisible="1"/>
<field name="create_date" invisible="1"/>
<field name="nbr"/>
</tree>
</field>
</record>
@ -60,8 +62,8 @@
<field name="name">All Users files</field>
<field name="res_model">report.document.user</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="context">{'search_default_user': 'user_id'}</field>
<field name="view_mode">tree,form</field>
<field name="context">{'group_by': ['name','month']}</field>
<field name="search_view_id" ref="view_report_document_user_search"/>
</record>
@ -112,30 +114,18 @@
<field name="arch" type="xml">
<graph string="Files by Resource Type" type="pie">
<field name="type" />
<!-- <field name="file_size" operator="+"/>-->
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<!-- <record model="ir.ui.view" id="view_document_by_resourcetype_tree">-->
<!-- <field name="name">report.document.resource.tree.view</field>-->
<!-- <field name="model">report.document.user</field>-->
<!-- <field name="type">tree</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Files by Resource Type">-->
<!-- <field name="type" />-->
<!-- <field name="nbr"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<record model="ir.actions.act_window" id="action_view_document_by_resourcetype_graph">
<field name="name">Files by Resource Type</field>
<field name="res_model">report.document.user</field>
<field name="view_id" ref="view_document_by_resourcetype_graph"></field>
<field name="view_id" ref="view_document_by_resourcetype_graph"/>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_mode">graph,tree</field>
</record>
<!--***************************************************************************************-->
@ -150,7 +140,7 @@
<field name="file_size" operator="+"/>
</graph>
</field>
</record>
</record>
<record model="ir.ui.view" id="view_size_month_tree">
<field name="name">report.document.user.tree</field>

View File

@ -196,7 +196,7 @@
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
ftp.mkd("Test-Folder2")
ftp.mkd("Test-Folder3")
# TODO move
-
I remove the 'Test-Folder3'

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<form string="Browse Document">
<separator string="Browse Document" colspan="4"/>
<field name="url" widget="url" colspan="4"/>
<field name="url" widget="url" colspan="4" width="250"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<label string="" colspan="2"/>

View File

@ -30,7 +30,7 @@ class document_ftp_configuration(osv.osv_memory):
_rec_name = 'host'
_columns = {
'host': fields.char('Address', size=64,
help="Server address or IP and port to which users should connect to for DMS access",
help="Server address or IP and port to which users should connect to for DMS access",
required=True),
}

View File

@ -113,6 +113,7 @@
<menuitem id="menu_project_working_hours" parent="base.menu_project_management_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_partner_invc" name="Partner Invoice" parent="base.menu_project_management_time_tracking" action="account.action_invoice_tree1"/>
<record id="hr_timesheet_employee_extd_form" model="ir.ui.view">
<field name="name">hr.timesheet.employee.extd_form</field>

View File

@ -89,7 +89,7 @@ class report_project_task_user(osv.osv):
planned_hours as hours_planned,
(extract('epoch' from (t.date_end-t.create_date)))/(3600*24) as closing_days,
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
(extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24) as delay_endings_days
abs((extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24)) as delay_endings_days
FROM project_task t
GROUP BY