[IMP] hr_payroll: convert the wizard into osv_memory and add the search view
bzr revid: sbh@tinyerp.com-20100630104716-pjppif2wwokxqn8l
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
'hr_payroll_sequence.xml',
|
||||
'hr_paroll_report.xml',
|
||||
'hr_payroll_data.xml',
|
||||
'wizard/hr_payroll_create_analytic.xml',
|
||||
'hr_payroll_wizard.xml'
|
||||
],
|
||||
'demo_xml': [
|
||||
|
||||
@@ -701,14 +701,40 @@
|
||||
<field name="contribute_per"/>
|
||||
<field name="amount_type"/>
|
||||
<field name="register_id"/>
|
||||
<field name="category_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_company_contribution_filter" model="ir.ui.view">
|
||||
<field name="name">company.contribution.select</field>
|
||||
<field name="model">company.contribution</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Company Contribution">
|
||||
<group col="8" colspan="4">
|
||||
<filter icon="terp-document-new" string="Fixed Amount" domain="[('amount_type','=','fix')]" help="Draft Slip"/>
|
||||
<filter icon="terp-camera_test" string="Function Calculation" domain="[('amount_type','=','func')]" help="Posted Slip"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="contribute_per"/>
|
||||
<field name="register_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col="8" colspan="4" expand="0" string="Group By...">
|
||||
<filter string="Type" icon="terp-partner" name="amount_type" context="{'group_by':'amount_type'}"/>
|
||||
<filter string="Category" name="category_id" icon="terp-go-month" context="{'group_by':'category_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_hr_company_contribution_tree" model="ir.actions.act_window">
|
||||
<field name="name">Company Contributions</field>
|
||||
<field name="res_model">company.contribution</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="hr_company_contribution_tree"/>
|
||||
<field name="search_view_id" ref="view_hr_company_contribution_filter"/>
|
||||
</record>
|
||||
<menuitem
|
||||
id="menu_hr_company_contribution_tree"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import wizard_year_salary
|
||||
import wizard_employees_detail
|
||||
import wizard_create_analytic
|
||||
import hr_payroll_create_analytic
|
||||
|
||||
+28
-54
@@ -1,59 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding:utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# d$
|
||||
# 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 General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# 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 General Public License for more details.
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import time
|
||||
|
||||
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>'''
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
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']
|
||||
class hr_payroll_create_analytic(osv.osv):
|
||||
_name = "hr.payroll.create.analytic"
|
||||
_columns = {
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'type': fields.selection([('bydeg','By Employee Function'), ('byallded','By Allownce / Deduction')],'Type'),
|
||||
}
|
||||
|
||||
def do_duplicate(self, cr, uid, ids, context):
|
||||
|
||||
account_pool =self.pool.get('account.analytic.account')
|
||||
func_pool = self.pool.get('hr.employee.grade')
|
||||
ad_pool = self.pool.get('hr.allounce.deduction.categoty')
|
||||
data=self.read(cr,uid,ids)[0]
|
||||
tpy = data['type']
|
||||
company = data['company_id']
|
||||
|
||||
function_ids = func_pool.search(cr, uid, [])
|
||||
ad_ids = ad_pool.search(cr, uid, [])
|
||||
@@ -109,16 +94,5 @@ class wizard_create_analytics(wizard.interface):
|
||||
}
|
||||
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')
|
||||
return {}
|
||||
hr_payroll_create_analytic()
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_payroll_create_form" model="ir.ui.view">
|
||||
<field name="name">Create Analytic</field>
|
||||
<field name="model">hr.payroll.create.analytic</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Process Form">
|
||||
<field name="company_id"/>
|
||||
<field name="type"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="do_duplicate" string="Process" colspan="1" type="object" icon="gtk-yes"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_hr_payroll_create" model="ir.actions.act_window">
|
||||
<field name="name">Create Analytic Structure</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.payroll.create.analytic</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- <menuitem id="menu_wizard_payroll_analysis"
|
||||
action="action_view_hr_payroll_create"
|
||||
parent="payroll_configure"
|
||||
name="Create Analytic Structure" />-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user