[IMP] HR: add the configuration wizard(new added file >> hr/res_config.py, hr/res_config_view.xml,hr_recruitment/res_config.py, hr_recruitment/res_config_view.xml, hr_timesheet_sheet/res_config.py, hr_timesheet_sheet/res_config_view.xml)

bzr revid: jap@tinyerp.com-20120402054418-596gzjhyne7o6148
This commit is contained in:
Jagdish Panchal (Open ERP) 2012-04-02 11:14:18 +05:30
parent 4177a9ec1c
commit 37465c6ea5
16 changed files with 337 additions and 2 deletions

View File

@ -24,5 +24,6 @@ import hr
import report
import wizard
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -50,6 +50,7 @@ You can manage:
'hr_installer.xml',
'hr_data.xml',
'hr_board.xml',
'res_config_view.xml',
],
'demo_xml': [
'hr_demo.xml',

74
addons/hr/res_config.py Normal file
View File

@ -0,0 +1,74 @@
# -*- 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/>.
#
##############################################################################
from osv import fields, osv
from lxml import etree
class human_resources_configuration(osv.osv_memory):
_name = 'human.resources.configuration'
_inherit = 'res.config.settings'
_columns = {
'module_hr_timesheet_sheet': fields.boolean('Manage Timesheet and Attendances',
help ="""It installs the hr_timesheet_sheet module."""),
'module_hr_holidays': fields.boolean('Manage Holidays',
help ="""It installs the hr_holidays module."""),
'module_hr_payroll': fields.boolean('Configure Your Payroll Structure',
help ="""It installs the hr_payroll module."""),
'module_hr_expense': fields.boolean('Manage Employees Expenses',
help ="""It installs the hr_expense module."""),
'module_hr_recruitment': fields.boolean('Manage Recruitment Process',
help ="""It installs the hr_payroll module."""),
'module_hr_contract': fields.boolean('Manage Employees Contracts',
help ="""It installs the hr_contract module."""),
'module_hr_evaluation': fields.boolean('Manage Appraisals Process',
help ="""It installs the hr_evaluation module."""),
'module_l10n_be_hr_payroll': fields.boolean('Allow to change Payroll Rules',
help ="""It allow to change payroll Rules."""),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
ir_module = self.pool.get('ir.module.module')
payroll_id= ir_module.search(cr, uid, [('name','=','hr_payroll')])
recruitment_id= ir_module.search(cr, uid, [('name','=','hr_recruitment')])
timesheet_id= ir_module.search(cr, uid, [('name','=','hr_timesheet_sheet')])
payroll_modle_state = ir_module.browse(cr,uid, payroll_id[0],context=context).state
recruitment_modle_state = ir_module.browse(cr,uid, recruitment_id[0],context=context).state
timesheet_modle_state = ir_module.browse(cr,uid, timesheet_id[0],context=context).state
res = super(human_resources_configuration, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
doc = etree.XML(res['arch'])
if recruitment_modle_state == 'uninstalled':
for node in doc.xpath("//group[@name='Recruitment']"):
node.set('invisible', '1')
res['arch'] = etree.tostring(doc)
return res
human_resources_configuration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,42 @@
<openerp>
<data>
<record id="view_human_resources_configuration" model="ir.ui.view">
<field name="name">Human Resources Application</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string ="HR Application">
<separator string="Human Resources" colspan="4"/>
<group colspan="4" col="4">
<label string="Create Your Departments :" />
<button name="%(view_department_form_installer)d" string="Departments" type="action" icon="gtk-apply"/>
<label string="Create Your Employees :" />
<button name="%(action_create_hr_employee_installer)d" string="Employees" type="action" icon="gtk-apply"/>
<field name="module_hr_timesheet_sheet"/>
<field name="module_hr_holidays"/>
</group>
<separator string="Additional Features" colspan="4"/>
<group colspan="4" col="4">
<field name="module_hr_expense"/>
<field name="module_hr_recruitment"/>
<field name="module_hr_evaluation"/>
<field name="module_hr_contract"/>
</group>
</form>
</field>
</record>
<record id="action_human_resources_configuration" model="ir.actions.act_window">
<field name="name">Configure Human Resources Application</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">human.resources.configuration</field>
<field name="view_id" ref="view_human_resources_configuration"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem id="menu_human_resources_configuration" name="Human Resources" parent="base.menu_config" sequence="13" action="action_human_resources_configuration"/>
</data>
</openerp>

View File

@ -14,5 +14,21 @@
<field name="action_id" ref="action_evaluation_plans_installer" />
<field name="category_id" ref="hr.category_hr_management_config" />
</record>
<!-- Hr Configuration wizard -->
<record id="view_evaluation_config_wizard_inherit" model="ir.ui.view">
<field name="name">human.evaluation.resources.configuration.form.inherit</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_evaluation" position="after">
<label string="Create Appraisal Plans :" />
<button name="%(action_evaluation_plans_installer)d" string="Appraisal Plans" type="action" icon="gtk-apply"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -32,5 +32,21 @@
<field name="category_id" ref="hr.category_hr_management_config"/>
<field name="sequence">3</field>
</record>
<!-- Hr Configuration wizard -->
<record id="view_expenseconfig_wizard_inherit" model="ir.ui.view">
<field name="name">human.expense.resources.configuration.form.inherit</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_expense" position="after">
<label string="Create Expenses Products :" />
<button name="%(product_normal_form_view_installer)d" string="Expenses Products" type="action" icon="gtk-apply"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -489,6 +489,22 @@
<field name="category_id" ref="hr.category_hr_management_config"/>
</record>
<!-- Hr Configuration wizard -->
<record id="view_config_wizard_inherit" model="ir.ui.view">
<field name="name">human.resources.configuration.form.inherit</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_holidays" position="after">
<label string="Allocate Leaves :" />
<button name="%(hr_holidays.hr_holidays_leaves_assign_legal)d" string="Allocate Leaves" type="action" icon="gtk-apply"/>
</field>
</field>
</record>
<!-- Hr employee inherit Legal Leaves -->
<record id="view_employee_form_leave_inherit" model="ir.ui.view">

View File

@ -22,5 +22,6 @@
import hr_recruitment
import report
import wizard
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -49,7 +49,8 @@ system to store and search in your CV base.
'security/ir.model.access.csv',
'report/hr_recruitment_report_view.xml',
'board_hr_recruitment_statistical_view.xml',
'hr_recruitment_installer_view.xml'
'hr_recruitment_installer_view.xml',
'res_config_view.xml',
],
'init_xml': [
'hr_recruitment_data.xml'

View File

@ -15,5 +15,21 @@
<field name="category_id" ref="hr.category_hr_management_config"/>
<field name="sequence">3</field>
</record>
<!-- Hr Configuration wizard -->
<record id="view_recruitment_config_wizard_inherit" model="ir.ui.view">
<field name="name">human.recruitment.resources.configuration.form.inherit</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_recruitment" position="after">
<label string="Create Recruitment Stages :" />
<button name="%(hr_recruitment_stage_form_installer)d" string="Recruitment Stages" type="action" icon="gtk-apply"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,50 @@
# -*- 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/>.
#
##############################################################################
from osv import osv, fields
class hr_applicant_settings(osv.osv_memory):
_name = 'human.resources.configuration'
_inherit = ['human.resources.configuration', 'fetchmail.config.settings']
_columns = {
'fetchmail_applicants': fields.boolean('Create Applicants from an email account',
fetchmail_model='hr.applicant', fetchmail_name='Incoming Application',
help ="""It allow to create applicant from an email account."""),
'applicants_server': fields.char('Server', size=256),
'applicants_port': fields.integer('Port'),
'applicants_type': fields.selection([
('pop', 'POP Server'),
('imap', 'IMAP Server'),
('local', 'Local Server'),
], 'Type'),
'applicants_is_ssl': fields.boolean('SSL/TLS',
help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP=995)"),
'applicants_user': fields.char('Username', size=256),
'applicants_password': fields.char('Password', size=1024),
}
_defaults = {
'applicants_type': 'pop',
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_apll_config_settings" model="ir.ui.view">
<field name="name">Human Resources Application</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='module_hr_contract']" position="after">
<group name="Recruitment" colspan="4" col="4" >
<separator string="Recruitment" colspan="4"/>
<field name="fetchmail_applicants" />
<group attrs="{'invisible': [('fetchmail_applicants','=',False)]}">
<field name="applicants_server"/>
<field name="applicants_type" on_change="onchange_fetchmail('applicants', applicants_type, applicants_is_ssl)"/>
<field name="applicants_port"/>
<field name="applicants_is_ssl" on_change="onchange_fetchmail('applicants', applicant_type, applicants_is_ssl)"/>
<field name="applicants_user"/>
<field name="applicants_password" password="True"/>
</group>
</group>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -22,5 +22,6 @@
import hr_timesheet_sheet
import wizard
import report
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -61,7 +61,8 @@ The validation can be configured in the company:
'report/hr_timesheet_report_view.xml',
'report/timesheet_report_view.xml',
'wizard/hr_timesheet_current_view.xml',
'hr_timesheet_sheet_data.xml'
'hr_timesheet_sheet_data.xml',
'res_config_view.xml',
],
'demo_xml': ['hr_timesheet_sheet_demo.xml',

View File

@ -0,0 +1,45 @@
# -*- 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/>.
#
##############################################################################
from osv import osv, fields
class hr_timeshee_settings(osv.osv_memory):
_name = 'human.resources.configuration'
_inherit = ['human.resources.configuration','res.company']
_columns = {
'timesheet_range': fields.selection(
[('day','Day'),('week','Week'),('month','Month')], 'Timesheet range',
help="Periodicity on which you validate your timesheets."),
'timesheet_max_difference': fields.float('Timesheet allowed difference(Hours)',
help="Allowed difference in hours between the sign in/out and the timesheet " \
"computation for one sheet. Set this to 0 if you do not want any control."),
}
def default_get(self, cr, uid, fields, context):
ir_values = self.pool.get('ir.values')
res = super(hr_timeshee_settings, self).default_get(cr, uid, fields, context=context)
res_cmp = ir_values.get_default(cr, uid, 'res.company', 'timesheet_range')
print "----------", res_cmp
return res

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timehseet_config_settings" model="ir.ui.view">
<field name="name">Human Resources Application</field>
<field name="model">human.resources.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='module_hr_timesheet_sheet']" position="after">
<label string="Create Your Timesheet Accounts :"/>
<button name="%(hr_timesheet.action_define_analytic_structure)d" string="Timesheet Accounts" type="action" icon="gtk-apply"/>
</xpath>
<xpath expr="//field[@name='module_hr_contract']" position="after">
<newline/>
<group name="Timesheets" colspan="4" col="8">
<separator string="Timesheets" colspan="12"/>
<field name="timesheet_range"/>
<field name="timesheet_max_difference"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>