[ADD] hr_timesheet: Employee Timesheet => OSV Memory (Not merge)

bzr revid: mra@tinyerp.com-20100419064200-9v0lwddsyh0qmt0u
This commit is contained in:
mra (Open ERP) 2010-04-19 12:12:00 +05:30
parent 4738eeb564
commit 6c69d44126
4 changed files with 81 additions and 20 deletions

View File

@ -44,7 +44,8 @@ to set up a management by affair.
'hr_timesheet_view.xml', 'hr_timesheet_view.xml',
'hr_timesheet_report.xml', 'hr_timesheet_report.xml',
'hr_timesheet_wizard.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'], 'demo_xml': ['hr_timesheet_demo.xml'],
'installable': True, 'installable': True,

View File

@ -13,15 +13,15 @@
sequence="1" /> 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"/> <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 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" <!-- <menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"
groups="hr.group_hr_manager"/>--> 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" 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"/> <wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
<menuitem <menuitem
action="wizard_hr_timesheet_my" action="wizard_hr_timesheet_my"

View File

@ -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>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,13 +15,14 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # 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 datetime
import wizard import wizard
from osv import osv, fields
import netsvc import netsvc
dates_form = '''<?xml version="1.0"?> dates_form = '''<?xml version="1.0"?>
@ -49,23 +50,43 @@ def _get_value(self, cr, uid, data, context):
today = datetime.date.today() today = datetime.date.today()
return dict(month=today.month, year=today.year, user_id=uid) return dict(month=today.month, year=today.year, user_id=uid)
class wizard_report(wizard.interface): class analytical_timesheet_employee(osv.osv_memory):
states = { _name = 'hr.analytical.timesheet.employee'
'init': { _description = 'Print Employee Timesheet'
'actions': [_get_value], _columns = {
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} 'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
}, 'Month', required=True),
'report': { 'year': fields.integer('Year', required=True),
'actions': [], 'user_id': fields.many2one('res.users', 'User', required=True)
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'} }
}
} def _get_user(self, cr, uid, context=None):
wizard_report('hr.analytical.timesheet') 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): class wizard_report_my(wizard.interface):
states = { states = {
'init': { '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')]} 'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
}, },
'report': { 'report': {