[IMP] hr.config.settings: improve code and form layout

bzr revid: rco@openerp.com-20120410115219-78ydkfe521am7g5n
This commit is contained in:
Raphael Collet 2012-04-10 13:52:19 +02:00
parent 63673df964
commit 068619bf8f
11 changed files with 106 additions and 112 deletions

View File

@ -20,27 +20,24 @@
##############################################################################
from osv import fields, osv
from lxml import etree
class human_resources_configuration(osv.osv_memory):
class hr_config_settings(osv.osv_memory):
_name = 'hr.config.settings'
_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_timesheet_sheet': fields.boolean('Manage Timesheets and Attendances',
help ="""This installs the module hr_timesheet_sheet."""),
'module_hr_holidays': fields.boolean('Manage Holidays',
help ="""It installs the hr_holidays module."""),
help ="""This installs the module hr_holidays."""),
'module_hr_expense': fields.boolean('Manage Employees Expenses',
help ="""It installs the hr_expense module."""),
help ="""This installs the module hr_expense."""),
'module_hr_recruitment': fields.boolean('Manage Recruitment Process',
help ="""It installs the hr_payroll module."""),
help ="""This installs the module hr_recruitment."""),
'module_hr_contract': fields.boolean('Manage Employees Contracts',
help ="""It installs the hr_contract module."""),
help ="""This installs the module hr_contract."""),
'module_hr_evaluation': fields.boolean('Manage Appraisals Process',
help ="""It installs the hr_evaluation module."""),
}
human_resources_configuration()
help ="""This installs the module hr_evaluation."""),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -5,7 +5,7 @@
<field name="name">Payroll</field>
<field name="res_model">ir.module.module</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('shortdesc','ilike','Payroll'),('state','=','uninstalled'),('name','!=','hr_payroll_account')]</field>
<field name="domain">[('state','=','uninstalled'), ('name','ilike','payroll'), ('name','!=','hr_payroll_account')]</field>
</record>
<record id="view_human_resources_configuration" model="ir.ui.view">
@ -15,23 +15,38 @@
<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="terp-personal+"/>
<label string="Create Your Employees :" />
<button name="%(open_view_employee_list_my)d" string="Employees" type="action" icon="terp-personal"/>
<field name="module_hr_timesheet_sheet"/>
<field name="module_hr_holidays"/>
<label string="Configure Your Salary Rules :"/>
<button string="Salary Rules" icon="gtk-go-forward" name="%(open_payroll1_modules)d" type="action" />
</group>
<label string="Departments :"/>
<label colspan="1"/>
<button name="%(view_department_form_installer)d" string="Create Your Departments"
type="action" icon="terp-personal+"/>
<newline/>
<label string="Employees :" />
<label colspan="1"/>
<button name="%(open_view_employee_list_my)d" string="Create Your Employees"
type="action" icon="terp-personal"/>
<newline/>
<field name="module_hr_timesheet_sheet"/>
<newline/>
<field name="module_hr_holidays"/>
<newline/>
<label string="Salary Rules :"/>
<label colspan="1"/>
<button string="Configure Your Salary Rules" icon="gtk-go-forward"
name="%(open_payroll1_modules)d" type="action" />
<separator string="Additional Features" colspan="4"/>
<group name="additional features" 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>
<field name="module_hr_expense"/>
<newline/>
<field name="module_hr_recruitment"/>
<newline/>
<field name="module_hr_evaluation"/>
<newline/>
<field name="module_hr_contract"/>
<group name="config_timesheets" colspan="4"/>
<group name="config_payroll" colspan="4"/>
<group name="config_recruitment" colspan="4"/>
<label colspan="2"/>
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
<button string="Apply" icon="gtk-apply" type="object" name="execute"/>

View File

@ -16,7 +16,6 @@
</record>
<!-- Hr Configuration wizard -->
<record id="view_evaluation_config_wizard_inherit" model="ir.ui.view">
<field name="name">hr settings for evaluations</field>
<field name="model">hr.config.settings</field>
@ -24,13 +23,11 @@
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_evaluation" position="after">
<group colspan="2" col="2">
<label string="Create Appraisal Plans : " />
<button name="%(action_evaluation_plans_installer)d" string="Appraisal Plans" type="action" icon="terp-stock_align_left_24"/>
</group>
<button name="%(action_evaluation_plans_installer)d" string="Create Appraisal Plans"
type="action" icon="terp-stock_align_left_24"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -34,7 +34,6 @@
</record>
<!-- Hr Configuration wizard -->
<record id="view_expenseconfig_wizard_inherit" model="ir.ui.view">
<field name="name">hr settings for expenses</field>
<field name="model">hr.config.settings</field>
@ -42,13 +41,11 @@
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<field name="module_hr_expense" position="after">
<group colspan="2" col="2">
<label string="Create Expenses Products :" />
<button name="%(product_normal_form_view_installer)d" string="Expenses Products" type="action" icon="terp-accessories-archiver"/>
</group>
<button name="%(product_normal_form_view_installer)d" string="Create Expenses Products"
type="action" icon="terp-accessories-archiver"/>
</field>
</field>
</record>
</record>
</data>
</openerp>

View File

@ -491,7 +491,6 @@
</record>
<!-- Hr Configuration wizard -->
<record id="view_config_wizard_inherit" model="ir.ui.view">
<field name="name">hr settings for holidays</field>
<field name="model">hr.config.settings</field>
@ -499,13 +498,11 @@
<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

@ -24,6 +24,6 @@ from osv import osv, fields
class human_resources_configuration(osv.osv_memory):
_inherit = 'hr.config.settings'
_columns = {
'module_hr_payroll_account': fields.boolean('Manage Account Payroll',
help ="""It installs the hr_payroll_account module."""),
}
'module_hr_payroll_account': fields.boolean('Manage Account Payroll',
help ="""This installs the module hr_payroll_account."""),
}

View File

@ -7,12 +7,10 @@
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='additional features']" position="after">
<group name="Account Payroll" colspan="4" col="4">
<separator string="Account Payroll" colspan="4"/>
<field name="module_hr_payroll_account"/>
</group>
</xpath>
<group name="config_payroll" position="after">
<separator string="Account Payroll" colspan="4"/>
<field name="module_hr_payroll_account"/>
</group>
</field>
</record>
</data>

View File

@ -26,10 +26,13 @@ class hr_applicant_settings(osv.osv_memory):
_inherit = ['hr.config.settings', '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."""),
'module_document_ftp': fields.boolean('Index & Track Documents',
help="""Manage your CV's and motivation letter related to all applicants.
This installs the module document_ftp."""),
'fetchmail_applicants': fields.boolean('Create Applicants from an Email Account',
fetchmail_model='hr.applicant', fetchmail_name='Incoming HR Applications',
help ="""Allow applicants to send their job application to an email address (jobs@mycompany.com),
and create automatically application documents in the system."""),
'applicants_server': fields.char('Server', size=256),
'applicants_port': fields.integer('Port'),
'applicants_type': fields.selection([
@ -41,7 +44,6 @@ class hr_applicant_settings(osv.osv_memory):
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 = {

View File

@ -1,33 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_apll_config_settings" model="ir.ui.view">
<field name="name">hr settings for recruitment</field>
<field name="model">hr.config.settings</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_recruitment']" position="after">
<group colspan="2" col="2">
<label string="Create Recruitment Stages :" />
<button name="%(hr_recruitment_stage_form_installer)d" string="Recruitment Stages" type="action" icon="terp-stage"/>
</group>
</xpath>
<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', applicants_type, applicants_is_ssl)"/>
<field name="applicants_user"/>
<field name="applicants_password" password="True"/>
<field name="module_hr_recruitment" position="after">
<button name="%(hr_recruitment_stage_form_installer)d" string="Create Recruitment Stages"
type="action" icon="terp-stage"/>
</field>
<group name="config_recruitment" position="after">
<separator string="Recruitment" colspan="4"/>
<field name="module_document_ftp"/>
<newline/>
<field name="fetchmail_applicants"/>
<group colspan="2" 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', applicants_type, applicants_is_ssl)"/>
<field name="applicants_user"/>
<field name="applicants_password" password="True"/>
</group>
</group>
</xpath>
</field>
</record>
</data>

View File

@ -20,30 +20,29 @@
##############################################################################
from osv import osv, fields
import pooler
class hr_timeshee_settings(osv.osv_memory):
class hr_timesheet_settings(osv.osv_memory):
_inherit = 'hr.config.settings'
_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."),
'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=None):
res = super(hr_timeshee_settings, self).default_get(cr, uid, fields, context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
res['timesheet_range']=user.company_id.timesheet_range
res['timesheet_max_difference']=user.company_id.timesheet_max_difference
return res
def set_timesheet_defaults(self, cr, uid, ids, context=None):
wizard = self.browse(cr, uid, ids)[0]
tm_range = wizard.timesheet_range
tm_diff = wizard.timesheet_max_difference
def get_default_timesheet(self, cr, uid, fields, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return {
'timesheet_range': user.company_id.timesheet_range,
'timesheet_max_difference': user.company_id.timesheet_max_difference,
}
def set_default_timesheet(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
user = self.pool.get('res.users').browse(cr, uid, uid, context)
user.company_id.write({'timesheet_range': tm_range,'timesheet_max_difference': tm_diff})
return {}
user.company_id.write({
'timesheet_range': config.timesheet_range,
'timesheet_max_difference': config.timesheet_max_difference,
})

View File

@ -1,25 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timehseet_config_settings" model="ir.ui.view">
<field name="name">hr settings for timesheets</field>
<field name="model">hr.config.settings</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="terp-folder-green"/>
</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 name="module_hr_timesheet_sheet" position="after">
<button name="%(hr_timesheet.action_define_analytic_structure)d" string="Create Your Timesheet Accounts" type="action" icon="terp-folder-green"/>
</field>
<group name="config_timesheets" position="after">
<separator string="Timesheets" colspan="4"/>
<field name="timesheet_range"/>
<field name="timesheet_max_difference"/>
</group>
</field>
</record>
</data>