[ADD] hr_timesheet: Employee Timesheet => OSV Memory (Not merge)
bzr revid: mra@tinyerp.com-20100419064200-9v0lwddsyh0qmt0u
This commit is contained in:
parent
4738eeb564
commit
6c69d44126
|
@ -44,7 +44,8 @@ to set up a management by affair.
|
|||
'hr_timesheet_view.xml',
|
||||
'hr_timesheet_report.xml',
|
||||
'hr_timesheet_wizard.xml',
|
||||
'process/hr_timesheet_process.xml'
|
||||
'process/hr_timesheet_process.xml',
|
||||
'wizard/hr_timesheet_print_employee_view.xml'
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'installable': True,
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
sequence="1" />
|
||||
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
|
||||
<!--<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
-->
|
||||
<!--<menuitem id="next_id_48" name="Timesheet" parent="hr.menu_hr_reporting"/>-->
|
||||
<!-- <menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"
|
||||
groups="hr.group_hr_manager"/>-->
|
||||
<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
<!--<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
|
||||
groups="hr.group_hr_manager"
|
||||
/>
|
||||
/>-->
|
||||
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
|
||||
<menuitem
|
||||
action="wizard_hr_timesheet_my"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_timesheet_employee" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.employee.form</field>
|
||||
<field name="model">hr.analytical.timesheet.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employee Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_employee" model="ir.actions.act_window">
|
||||
<field name="name">Employee Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_employee"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_employee"
|
||||
id="menu_hr_timesheet_employee"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_manager" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,13 +15,14 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import wizard
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
|
@ -49,23 +50,43 @@ def _get_value(self, cr, uid, data, context):
|
|||
today = datetime.date.today()
|
||||
return dict(month=today.month, year=today.year, user_id=uid)
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.analytical.timesheet')
|
||||
class analytical_timesheet_employee(osv.osv_memory):
|
||||
_name = 'hr.analytical.timesheet.employee'
|
||||
_description = 'Print Employee Timesheet'
|
||||
_columns = {
|
||||
'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
|
||||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True)
|
||||
}
|
||||
|
||||
def _get_user(self, cr, uid, context=None):
|
||||
return uid
|
||||
|
||||
_defaults = {
|
||||
'month': datetime.date.today().month,
|
||||
'year': datetime.date.today().year,
|
||||
'user_id': _get_user
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.analytical.timesheet',
|
||||
'datas': datas,
|
||||
}
|
||||
analytical_timesheet_employee()
|
||||
|
||||
class wizard_report_my(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
|
|
Loading…
Reference in New Issue