summaryrefslogtreecommitdiff
path: root/addons/hr_payroll/wizard
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
commitb0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch)
treee78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/hr_payroll/wizard
parent46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff)
parent2319190c5a20cb8095f85cacca89a33164ba93d7 (diff)
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/hr_payroll/wizard')
-rwxr-xr-xaddons/hr_payroll/wizard/__init__.py3
-rw-r--r--addons/hr_payroll/wizard/wizard_create_analytic.py124
-rwxr-xr-xaddons/hr_payroll/wizard/wizard_employees_detail.py60
-rwxr-xr-xaddons/hr_payroll/wizard/wizard_year_salary.py69
4 files changed, 256 insertions, 0 deletions
diff --git a/addons/hr_payroll/wizard/__init__.py b/addons/hr_payroll/wizard/__init__.py
new file mode 100755
index 00000000000..453998a44ca
--- /dev/null
+++ b/addons/hr_payroll/wizard/__init__.py
@@ -0,0 +1,3 @@
+import wizard_year_salary
+import wizard_employees_detail
+import wizard_create_analytic
diff --git a/addons/hr_payroll/wizard/wizard_create_analytic.py b/addons/hr_payroll/wizard/wizard_create_analytic.py
new file mode 100644
index 00000000000..371b0a2bda4
--- /dev/null
+++ b/addons/hr_payroll/wizard/wizard_create_analytic.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+#-*- 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 wizard
+import pooler
+
+class wizard_create_analytics(wizard.interface):
+ '''
+ OpenERP Wizard
+ '''
+ form = '''<?xml version="1.0"?>
+ <form string="Process Form">
+ <field name="company_id"/>
+ <newline/>
+ <field name="type"/>
+ </form>'''
+
+ fields = {
+ 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company'},
+ 'type': {'string':'Type', 'type':'selection', 'selection':[('bydeg','By Employee Function'), ('byallded','By Allownce / Deduction')]}
+ }
+
+ def _get_defaults(self, cr, user, data, context):
+ #TODO : initlize required data
+
+
+ return data['form']
+
+ def _do_duplicate(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ account_pool = pool.get('account.analytic.account')
+ func_pool = pool.get('hr.employee.grade')
+ ad_pool = pool.get('hr.allounce.deduction.categoty')
+
+ tpy = data['form']['type']
+ company = data['form']['company_id']
+
+ function_ids = func_pool.search(cr, uid, [])
+ ad_ids = ad_pool.search(cr, uid, [])
+
+ if tpy == 'bydeg':
+ for function in func_pool.browse(cr, uid, function_ids):
+ res = {
+ 'name':function.name,
+ 'company_id':company
+ }
+ fid = account_pool.create(cr, uid, res)
+ res = {
+ 'name':'Basic Salary',
+ 'company_id':company,
+ 'parent_id': fid
+ }
+ account_pool.create(cr, uid, res)
+ for ad in ad_pool.browse(cr, uid, ad_ids):
+ res = {
+ 'name':ad.name,
+ 'company_id':company,
+ 'parent_id': fid
+ }
+ account_pool.create(cr, uid, res)
+
+
+
+ elif tpy == 'byallded':
+ res = {
+ 'name':'Basic Salary',
+ 'company_id':company
+ }
+ adid = account_pool.create(cr, uid, res)
+ for function in func_pool.browse(cr, uid, function_ids):
+ res = {
+ 'name':function.name,
+ 'company_id':company,
+ 'parent_id': adid
+ }
+ account_pool.create(cr, uid, res)
+
+ for ad in ad_pool.browse(cr, uid, ad_ids):
+ res = {
+ 'name':ad.name,
+ 'company_id':company,
+ }
+ adid = account_pool.create(cr, uid, res)
+ for function in func_pool.browse(cr, uid, function_ids):
+ res = {
+ 'name':function.name,
+ 'company_id':company,
+ 'parent_id': adid
+ }
+ account_pool.create(cr, uid, res)
+
+ return {}
+
+ states = {
+ 'init': {
+ 'actions': [_get_defaults],
+ 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('process', 'Process'))},
+ },
+ 'process': {
+ 'actions': [_do_duplicate],
+ 'result': {'type': 'state', 'state': 'end'},
+ },
+ }
+wizard_create_analytics('payroll.analysis')
diff --git a/addons/hr_payroll/wizard/wizard_employees_detail.py b/addons/hr_payroll/wizard/wizard_employees_detail.py
new file mode 100755
index 00000000000..707a428229e
--- /dev/null
+++ b/addons/hr_payroll/wizard/wizard_employees_detail.py
@@ -0,0 +1,60 @@
+# -*- 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:
+
diff --git a/addons/hr_payroll/wizard/wizard_year_salary.py b/addons/hr_payroll/wizard/wizard_year_salary.py
new file mode 100755
index 00000000000..efab1695ba1
--- /dev/null
+++ b/addons/hr_payroll/wizard/wizard_year_salary.py
@@ -0,0 +1,69 @@
+# -*- 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/>
+ <separator string="Salary Deposit Date Option?" colspan="2"/>
+ <newline/>
+ <field name="salary_on"/>
+</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},
+ 'salary_on':{
+ 'string':"Salary On",
+ 'type':'selection',
+ 'selection':[('current_month','Current Month Date'),('next_month','Next Month Date')],
+ 'default': lambda *a:'current_month'
+ },
+ }
+
+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':'year.salary', 'state':'end'}
+ }
+ }
+wizard_print('wizard.year.salary')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+