[IMP] hr_payroll: Improve the view and code
bzr revid: sbh@tinyerp.com-20100701054809-7ttw11r6x3qeczpg
This commit is contained in:
parent
8a5e2b3927
commit
5a58c72228
|
@ -4,6 +4,8 @@
|
|||
<!-- Root Menus -->
|
||||
<menuitem id="menu_hr_root_payroll" parent="hr.menu_hr_root" name="Payroll"/>
|
||||
<menuitem id="payroll_configure" parent="hr.menu_hr_configuration" name="Payroll"/>
|
||||
<menuitem id="menu_hr_payroll_reporting" parent="hr.menu_hr_reporting" name="Payroll"/>
|
||||
|
||||
|
||||
<!-- Passport Views -->
|
||||
<record id="hr_passport_form" model="ir.ui.view">
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
#-*- coding:utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# d$
|
||||
#
|
||||
# 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 hr_payroll_employees_detail
|
||||
import hr_payroll_create_analytic
|
||||
import hr_payroll_year_salary
|
||||
|
|
|
@ -31,7 +31,7 @@ class hr_payroll_create_analytic(osv.osv_memory):
|
|||
'type': fields.selection([('bydeg','By Employee Function'), ('byallded','By Allownce / Deduction')],'Type'),
|
||||
}
|
||||
|
||||
def do_duplicate(self, cr, uid, ids, context):
|
||||
def do_duplicate(self, cr, uid, ids, context=None):
|
||||
|
||||
account_pool =self.pool.get('account.analytic.account')
|
||||
func_pool = self.pool.get('hr.employee.grade')
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem id="menu_hr_payroll_reporting" parent="hr.menu_hr_reporting" name="Payroll"/>
|
||||
<!-- <menuitem id="menu_wizard_payroll_analysis"
|
||||
action="action_view_hr_payroll_create"
|
||||
parent="payroll_configure"
|
||||
|
|
|
@ -25,22 +25,23 @@ from osv import fields, osv
|
|||
from tools.translate import _
|
||||
|
||||
class hr_payroll_employees_detail(osv.osv_memory):
|
||||
|
||||
_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={}):
|
||||
def _get_fiscalyear(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,
|
||||
'fiscalyear_id':_get_fiscalyear,
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context={}):
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
|
@ -52,7 +53,7 @@ class hr_payroll_employees_detail(osv.osv_memory):
|
|||
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id'], context)
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
return {
|
||||
|
|
|
@ -32,18 +32,18 @@ class hr_payroll_year_salary(osv.osv_memory):
|
|||
'salary_on': fields.selection([('current_month','Current Month Date'),('next_month','Next Month Date')],'Salary On'),
|
||||
}
|
||||
|
||||
def _get_defaults(self, cr, uid, ids, context={}):
|
||||
fiscal_ids=self.pool.get('account.fiscalyear').search(cr,uid,[])
|
||||
def _get_fiscalyear(self, cr, uid, ids, context=None):
|
||||
fiscal_ids=self.pool.get('account.fiscalyear').search(cr,uid,[],context=context)
|
||||
if fiscal_ids:
|
||||
return fiscal_ids[0]
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'fiscalyear_id':_get_defaults,
|
||||
'salary_on': lambda *a:'current_month'
|
||||
'fiscalyear_id':_get_fiscalyear,
|
||||
'salary_on': 'current_month'
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context={}):
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
|
@ -55,10 +55,9 @@ class hr_payroll_year_salary(osv.osv_memory):
|
|||
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id','salary_on'], context)
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id','salary_on'], context=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': 'year.salary',
|
||||
|
|
Loading…
Reference in New Issue