[ADD] hr_timesheet: Sign in out by project -> osv memory
bzr revid: mra@tinyerp.com-20100421111052-xa417xjiclpi8mnz
This commit is contained in:
parent
d5f50a85d1
commit
7f74b98082
|
@ -46,7 +46,8 @@ to set up a management by affair.
|
|||
'hr_timesheet_wizard.xml',
|
||||
'process/hr_timesheet_process.xml',
|
||||
'wizard/hr_timesheet_print_employee_view.xml',
|
||||
'wizard/hr_timesheet_print_users_view.xml'
|
||||
'wizard/hr_timesheet_print_users_view.xml',
|
||||
'wizard/hr_timesheet_sign_in_out_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data><!--
|
||||
<wizard id="si_so" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>
|
||||
<menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_time_tracking" type="wizard"/>
|
||||
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import sign_in_out
|
||||
import hr_timesheet_sign_in_out
|
||||
import hr_timesheet_print_employee
|
||||
import hr_timesheet_print_users
|
||||
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class hr_so_project(osv.osv_memory):
|
||||
_name = 'hr.sign.out.project'
|
||||
_description = 'Sign Out By Project'
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','=','normal')]),
|
||||
'info': fields.char('Work Description', size=256, required=True),
|
||||
'date_start': fields.datetime('Starting Date', readonly=True),
|
||||
'date': fields.datetime('Closing Date'),
|
||||
'analytic_amount': fields.float('Minimum Analytic Amount'),
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=256, required=False),
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, context):
|
||||
res = self._get_empid(cr, uid, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
return res
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid2(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context=None):
|
||||
timesheet_obj = self.pool.get('hr.analytic.timesheet')
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['info']
|
||||
res['account_id'] = data['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context=context)
|
||||
|
||||
def sign_out_result_end(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
def sign_out_result(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
hr_so_project()
|
||||
|
||||
class hr_si_project(osv.osv_memory):
|
||||
_name = 'hr.sign.in.project'
|
||||
_description = 'Sign In By Project'
|
||||
_columns = {
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'date': fields.datetime('Starting Date'),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=512, required=False),
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
emp_id = self._get_empid(cr, uid, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
if res == 'sign_out':
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.in.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
else:
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.out.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def sign_in_result(self, cr, uid, ids, context):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [], context)[0]
|
||||
emp_id = data['emp_id']
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False)
|
||||
except except_osv, e:
|
||||
raise osv.except_osv(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
hr_si_project()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_hr_timesheet_sign_in_message" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.message.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="This Wizard will make Sign In/Out By Project" colspan="4"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Sign in / Sign out" name="check_state" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_sign_in" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Start Working" name="sign_in_result" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_in" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.in.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_in_message"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_sign_in"
|
||||
id="menu_hr_timesheet_sign_in"
|
||||
parent="hr_attendance.menu_hr_time_tracking"
|
||||
/>
|
||||
|
||||
<record id="view_hr_timesheet_sign_out" model="ir.ui.view">
|
||||
<field name="name">hr.sign.out.project.form</field>
|
||||
<field name="model">hr.sign.out.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/> </group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Change Work" name="sign_out_result" type="object"/>
|
||||
<button icon="gtk-ok" string="Stop Working" name="sign_out_result_end" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_out" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.out.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_out"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,174 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
si_form ='''<?xml version="1.0"?>
|
||||
<form string="Sign in / Sign out">
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</form>'''
|
||||
|
||||
si_fields = {
|
||||
'name': {'string': "Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string': "Current state", 'type' : 'char', 'required' : True, 'readonly': True},
|
||||
'date': {'string':"Starting Date", 'type':'datetime'},
|
||||
'server_date': {'string':"Current Date", 'type':'datetime', 'readonly':True},
|
||||
}
|
||||
|
||||
so_form = '''<?xml version="1.0" ?>
|
||||
<form string="Sign in status">
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/>
|
||||
</form>'''
|
||||
|
||||
so_fields = {
|
||||
'name': {'string':"Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string':"Current state", 'type':'char', 'required':True, 'readonly':True},
|
||||
'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
|
||||
'info': {'string':"Work Description", 'type':'char', 'size':256, 'required':True},
|
||||
'date': {'string':"Closing Date", 'type':'datetime'},
|
||||
'date_start': {'string':"Starting Date", 'type':'datetime', 'readonly':True},
|
||||
'server_date': {'string':"Current Server Date", 'type':'datetime', 'readonly':True},
|
||||
'analytic_amount': {'string':"Minimum Analytic Amount", 'type':'float'},
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'date':False, 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise wizard.except_wizard(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, data, context):
|
||||
res = _get_empid(self,cr, uid, data, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
res['info'] = ''
|
||||
res['account_id'] = False
|
||||
return res
|
||||
|
||||
def _sign_in_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
from osv.osv import except_osv
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['form']['date'] or False)
|
||||
except except_osv, e:
|
||||
raise wizard.except_wizard(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context):
|
||||
timesheet_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['form']['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['form']['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['form']['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise wizard.except_wizard(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['form']['info']
|
||||
res['account_id'] = data['form']['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context)
|
||||
|
||||
def _sign_out_result_end(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _sign_out_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _state_check(self, cr, uid, data, context):
|
||||
emp_id = _get_empid(self, cr, uid, data, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
return res
|
||||
|
||||
class wiz_si_so(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type' : 'choice', 'next_state': _state_check}
|
||||
},
|
||||
'sign_out' : { # this means sign_in...
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type':'form', 'arch':si_form, 'fields' : si_fields, 'state':[('end', 'Cancel'),('si_result', 'Start Working') ] }
|
||||
},
|
||||
'si_result' : {
|
||||
'actions' : [_sign_in_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'sign_in' : { # this means sign_out...
|
||||
'actions' : [_get_empid2],
|
||||
'result' : {'type':'form', 'arch':so_form, 'fields':so_fields, 'state':[('end', 'Cancel'),('so_result', 'Change Work'),('so_result_end', 'Stop Working') ] }
|
||||
},
|
||||
'so_result' : {
|
||||
'actions' : [_sign_out_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'so_result_end' : {
|
||||
'actions' : [_sign_out_result_end],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
}
|
||||
wiz_si_so('hr_timesheet.si_so')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue