[IMP] hr_timesheet_sheet : set a server action for my timesheet menu

bzr revid: vir@tinyerp.com-20101013120039-b4ffcjiv26koodwu
This commit is contained in:
Vir (Open ERP) 2010-10-13 17:30:39 +05:30
parent 5b2361fbbd
commit 4b0c69ab39
4 changed files with 31 additions and 1 deletions

View File

@ -49,13 +49,14 @@ The validation can be configured in the company:
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
'security/hr_timesheet_data.xml',
'security/hr_timesheet_sheet_security.xml',
'hr_timesheet_sheet_view.xml',
'hr_timesheet_workflow.xml',
'process/hr_timesheet_sheet_process.xml',
'board_hr_timesheet_view.xml',
'report/hr_timesheet_report_view.xml',
'wizard/hr_timesheet_current_view.xml',
'hr_timesheet_sheet_data.xml'
],
'demo_xml': ['hr_timesheet_sheet_demo.xml',

View File

@ -334,11 +334,16 @@ class hr_timesheet_sheet(osv.osv):
return time.strftime('%Y-12-31')
return time.strftime('%Y-%m-%d')
def _default_employee(self,cr, uid, context=None):
emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context)
return emp_ids and emp_ids[0] or False
_defaults = {
'date_from' : _default_date_from,
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
'date_to' : _default_date_to,
'state': 'new',
'employee_id': _default_employee,
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="ir_actions_server_timsheet_sheet" model="ir.actions.server">
<field eval="5" name="sequence"/>
<field eval="&quot;&quot;&quot;code&quot;&quot;&quot;" name="state"/>
<field eval="&quot;&quot;&quot;ir.actions.server&quot;&quot;&quot;" name="type"/>
<field name="model_id" ref="model_hr_timesheet_current_open"/>
<field eval="[(6,0,[])]" name="child_ids"/>
<field eval="&quot;&quot;&quot;action = self.pool.get('hr.timesheet.current.open').open_timesheet(cr, uid, object.id, context)&quot;&quot;&quot;" name="code"/>
<field eval="&quot;&quot;&quot;True&quot;&quot;&quot;" name="condition"/>
<field eval="&quot;&quot;&quot;My Timesheet&quot;&quot;&quot;" name="name"/>
</record>
<record id="menu_act_hr_timesheet_sheet_form_my_current" model="ir.ui.menu">
<field name="name">My Timesheet</field>
<field eval="1" name="sequence"/>
<field name="parent_id" ref="hr_attendance.menu_hr_time_tracking"/>
<field name="icon">STOCK_JUSTIFY_FILL</field>
<field name="action" ref="ir_actions_server_timsheet_sheet"/>
</record>
</data>
</openerp>