[IMP]: Improve search view of Task hours report of project_timesheet module and file descriptor close() in document module.

bzr revid: atp@tinyerp.co.in-20101112101416-51opsl6u147argqm
This commit is contained in:
atp (Open ERP) 2010-11-12 15:44:16 +05:30
parent a4a5c64fe4
commit 0397468a05
2 changed files with 33 additions and 12 deletions

View File

@ -96,8 +96,13 @@ class DocIndex(indexer):
def _doIndexFile(self,fname):
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
return _to_unicode(fp.read())
try:
file_data = _to_unicode(fp.read())
finally:
fp.close()
return file_data
cntIndex.register(DocIndex())
class DocxIndex(indexer):
@ -158,7 +163,12 @@ class PdfIndex(indexer):
def _doIndexFile(self,fname):
fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout
return _to_unicode( fp.read())
try:
file_data = _to_unicode( fp.read())
finally:
fp.close()
return file_data
cntIndex.register(PdfIndex())

View File

@ -31,17 +31,29 @@
<field name="arch" type="xml">
<search string="Tasks by User">
<group colspan="4" col="3">
<filter icon="terp-go-year" string="This Year" domain="[('year','=',time.strftime('%%Y'))]" />
<filter icon="terp-go-month" string="This Month" domain="[('month','=',time.strftime('%%m'))]" />
<filter icon="terp-go-year" string=" Year "
name="year"
domain="[('name','&lt;=', time.strftime('%%Y-%%m-%%d')),('name','&gt;=',time.strftime('%%Y-01-01'))]"
help="Task Hours in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('name','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('name','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Task Hours in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
domain="[('name','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('name','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Task hours of last month"/>
<separator orientation="vertical"/>
<field name="user_id" select="1" widget="selection"/>
<field name="user_id"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="3">
<filter string="User" icon="terp-personal" context="{'group_by':'user_id'}" default="1" />
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" />
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" />
</group>
<filter string="User" name="group_user_id" icon="terp-personal" context="{'group_by':'user_id'}" default="1" />
<separator orientation="vertical"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of date"/>
</group>
</search>
</field>
</record>
@ -64,8 +76,7 @@
<field name="res_model">report.timesheet.task.user</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_report_timesheet_task_user_search"/>
<field name="context">{'search_default_month':1, 'search_default_group_user_id':1}</field>
</record>
<menuitem id="menu_timesheet_task_user" parent="hr_timesheet.menu_hr_reporting_timesheet"
action="action_report_timesheet_task_user" sequence="1"/>