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):
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())
<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','<=', time.strftime('%%Y-%%m-%%d')),('name','>=',time.strftime('%%Y-01-01'))]"
+ help="Task Hours in current year"/>
+ <filter icon="terp-go-month" string=" Month "
+ name="month"
+ domain="[('name','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('name','>=',(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','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('name','>=',(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>
<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"/>