[IMP] hr_payroll: convert the wizard_employees_detail into osv_memeroy
bzr revid: sbh@tinyerp.com-20100630121632-i37b2t5wh26zu2l8
This commit is contained in:
parent
8a26c4f6e7
commit
0f5d7b52da
|
@ -51,6 +51,7 @@
|
|||
'hr_paroll_report.xml',
|
||||
'hr_payroll_data.xml',
|
||||
'wizard/hr_payroll_create_analytic.xml',
|
||||
'wizard/hr_payroll_employees_detail.xml',
|
||||
'hr_payroll_wizard.xml'
|
||||
],
|
||||
'demo_xml': [
|
||||
|
|
|
@ -70,8 +70,8 @@ class employees_salary_report(rml_parse.rml_parse):
|
|||
def get_employee(self,form):
|
||||
result = []
|
||||
periods = []
|
||||
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
|
||||
emp_ids = form['employee_ids'][0][2]
|
||||
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
|
||||
emp_ids = form['employee_ids']
|
||||
result = emp.browse(self.cr,self.uid, emp_ids)
|
||||
fiscalyear_obj = pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
|
||||
period_ids_l = fiscalyear_obj.period_ids
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import wizard_year_salary
|
||||
import hr_payroll_employees_detail
|
||||
import wizard_employees_detail
|
||||
import hr_payroll_create_analytic
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
# -*- 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 fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class hr_payroll_employees_detail(osv.osv):
|
||||
_name = "hr.payroll.employees.detail"
|
||||
_columns = {
|
||||
'employee_ids': fields.many2many('hr.employee', 'payroll_emp_rel','payroll_id','emp_id', 'Employees',required=True),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True)
|
||||
}
|
||||
def _get_defaults(self, cr, uid, ids, context={}):
|
||||
fiscal_ids=self.pool.get('account.fiscalyear').search(cr,uid,[])
|
||||
if fiscal_ids:
|
||||
return fiscal_ids[0]
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'fiscalyear_id':_get_defaults,
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : return report
|
||||
"""
|
||||
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id'], context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['form']['fiscalyear_id']=res['fiscalyear_id'][0]
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'employees.salary',
|
||||
'datas': datas,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
hr_payroll_employees_detail()
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_hr_payroll_employees_detail" model="ir.ui.view">
|
||||
<field name="name">Employee Salary Statement</field>
|
||||
<field name="model">hr.payroll.employees.detail</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Year Salary">
|
||||
<group col="4" colspan="4" width="500">
|
||||
<field name="fiscalyear_id"/>
|
||||
<newline/>
|
||||
<field name="employee_ids" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
type="object" icon="gtk-print" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_hr_payroll_employees_detail" model="ir.actions.act_window">
|
||||
<field name="name">Employee Salary Statement</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.payroll.employees.detail</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="action_hr_payroll_employees_detail1"
|
||||
icon="STOCK_PRINT"
|
||||
action="action_hr_payroll_employees_detail"
|
||||
parent="menu_hr_payroll_reporting"
|
||||
name="Employee Salary Statement"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,60 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import datetime
|
||||
import pooler
|
||||
import time
|
||||
import netsvc
|
||||
|
||||
form='''<?xml version="1.0"?>
|
||||
<form string="Year Salary">
|
||||
<field name="fiscalyear_id" select="1" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="employee_ids" colspan="2"/>
|
||||
<newline/>
|
||||
</form>'''
|
||||
fields = {
|
||||
'fiscalyear_id':{'string': 'Fiscal Year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True },
|
||||
'employee_ids':{'string':'Employees', 'type':'many2many','relation':'hr.employee','required':True},
|
||||
}
|
||||
|
||||
class wizard_print(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context={}):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear_id'] = fiscalyear_obj.find(cr, uid)
|
||||
return data['form']
|
||||
|
||||
states={
|
||||
'init':{
|
||||
'actions':[_get_defaults],
|
||||
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report':{
|
||||
'actions':[],
|
||||
'result':{'type':'print', 'report':'employees.salary', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_print('wizard.employees.detail')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue