[IMP] hr.config.settings: improve code and form layout
bzr revid: rco@openerp.com-20120410115219-78ydkfe521am7g5n
This commit is contained in:
parent
63673df964
commit
068619bf8f
|
@ -20,27 +20,24 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import fields, osv
|
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'
|
_name = 'hr.config.settings'
|
||||||
_inherit = 'res.config.settings'
|
_inherit = 'res.config.settings'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'module_hr_timesheet_sheet': fields.boolean('Manage Timesheet and Attendances',
|
'module_hr_timesheet_sheet': fields.boolean('Manage Timesheets and Attendances',
|
||||||
help ="""It installs the hr_timesheet_sheet module."""),
|
help ="""This installs the module hr_timesheet_sheet."""),
|
||||||
'module_hr_holidays': fields.boolean('Manage Holidays',
|
'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',
|
'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',
|
'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',
|
'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',
|
'module_hr_evaluation': fields.boolean('Manage Appraisals Process',
|
||||||
help ="""It installs the hr_evaluation module."""),
|
help ="""This installs the module hr_evaluation."""),
|
||||||
}
|
}
|
||||||
|
|
||||||
human_resources_configuration()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<field name="name">Payroll</field>
|
<field name="name">Payroll</field>
|
||||||
<field name="res_model">ir.module.module</field>
|
<field name="res_model">ir.module.module</field>
|
||||||
<field name="view_mode">kanban,tree,form</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>
|
||||||
|
|
||||||
<record id="view_human_resources_configuration" model="ir.ui.view">
|
<record id="view_human_resources_configuration" model="ir.ui.view">
|
||||||
|
@ -15,23 +15,38 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string ="HR Application">
|
<form string ="HR Application">
|
||||||
<separator string="Human Resources" colspan="4"/>
|
<separator string="Human Resources" colspan="4"/>
|
||||||
<group colspan="4" col="4">
|
<label string="Departments :"/>
|
||||||
<label string="Create Your Departments :" />
|
<label colspan="1"/>
|
||||||
<button name="%(view_department_form_installer)d" string="Departments" type="action" icon="terp-personal+"/>
|
<button name="%(view_department_form_installer)d" string="Create Your Departments"
|
||||||
<label string="Create Your Employees :" />
|
type="action" icon="terp-personal+"/>
|
||||||
<button name="%(open_view_employee_list_my)d" string="Employees" type="action" icon="terp-personal"/>
|
<newline/>
|
||||||
<field name="module_hr_timesheet_sheet"/>
|
<label string="Employees :" />
|
||||||
<field name="module_hr_holidays"/>
|
<label colspan="1"/>
|
||||||
<label string="Configure Your Salary Rules :"/>
|
<button name="%(open_view_employee_list_my)d" string="Create Your Employees"
|
||||||
<button string="Salary Rules" icon="gtk-go-forward" name="%(open_payroll1_modules)d" type="action" />
|
type="action" icon="terp-personal"/>
|
||||||
</group>
|
<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"/>
|
<separator string="Additional Features" colspan="4"/>
|
||||||
<group name="additional features" colspan="4" col="4">
|
<field name="module_hr_expense"/>
|
||||||
<field name="module_hr_expense"/>
|
<newline/>
|
||||||
<field name="module_hr_recruitment"/>
|
<field name="module_hr_recruitment"/>
|
||||||
<field name="module_hr_evaluation"/>
|
<newline/>
|
||||||
<field name="module_hr_contract"/>
|
<field name="module_hr_evaluation"/>
|
||||||
</group>
|
<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"/>
|
<label colspan="2"/>
|
||||||
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
||||||
<button string="Apply" icon="gtk-apply" type="object" name="execute"/>
|
<button string="Apply" icon="gtk-apply" type="object" name="execute"/>
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Hr Configuration wizard -->
|
<!-- Hr Configuration wizard -->
|
||||||
|
|
||||||
<record id="view_evaluation_config_wizard_inherit" model="ir.ui.view">
|
<record id="view_evaluation_config_wizard_inherit" model="ir.ui.view">
|
||||||
<field name="name">hr settings for evaluations</field>
|
<field name="name">hr settings for evaluations</field>
|
||||||
<field name="model">hr.config.settings</field>
|
<field name="model">hr.config.settings</field>
|
||||||
|
@ -24,13 +23,11 @@
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="module_hr_evaluation" position="after">
|
<field name="module_hr_evaluation" position="after">
|
||||||
<group colspan="2" col="2">
|
<button name="%(action_evaluation_plans_installer)d" string="Create Appraisal Plans"
|
||||||
<label string="Create Appraisal Plans : " />
|
type="action" icon="terp-stock_align_left_24"/>
|
||||||
<button name="%(action_evaluation_plans_installer)d" string="Appraisal Plans" type="action" icon="terp-stock_align_left_24"/>
|
|
||||||
</group>
|
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Hr Configuration wizard -->
|
<!-- Hr Configuration wizard -->
|
||||||
|
|
||||||
<record id="view_expenseconfig_wizard_inherit" model="ir.ui.view">
|
<record id="view_expenseconfig_wizard_inherit" model="ir.ui.view">
|
||||||
<field name="name">hr settings for expenses</field>
|
<field name="name">hr settings for expenses</field>
|
||||||
<field name="model">hr.config.settings</field>
|
<field name="model">hr.config.settings</field>
|
||||||
|
@ -42,13 +41,11 @@
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="module_hr_expense" position="after">
|
<field name="module_hr_expense" position="after">
|
||||||
<group colspan="2" col="2">
|
<button name="%(product_normal_form_view_installer)d" string="Create Expenses Products"
|
||||||
<label string="Create Expenses Products :" />
|
type="action" icon="terp-accessories-archiver"/>
|
||||||
<button name="%(product_normal_form_view_installer)d" string="Expenses Products" type="action" icon="terp-accessories-archiver"/>
|
|
||||||
</group>
|
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -491,7 +491,6 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Hr Configuration wizard -->
|
<!-- Hr Configuration wizard -->
|
||||||
|
|
||||||
<record id="view_config_wizard_inherit" model="ir.ui.view">
|
<record id="view_config_wizard_inherit" model="ir.ui.view">
|
||||||
<field name="name">hr settings for holidays</field>
|
<field name="name">hr settings for holidays</field>
|
||||||
<field name="model">hr.config.settings</field>
|
<field name="model">hr.config.settings</field>
|
||||||
|
@ -499,13 +498,11 @@
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="module_hr_holidays" position="after">
|
<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"/>
|
<button name="%(hr_holidays.hr_holidays_leaves_assign_legal)d" string="Allocate Leaves" type="action" icon="gtk-apply"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- Hr employee inherit Legal Leaves -->
|
<!-- Hr employee inherit Legal Leaves -->
|
||||||
|
|
||||||
<record id="view_employee_form_leave_inherit" model="ir.ui.view">
|
<record id="view_employee_form_leave_inherit" model="ir.ui.view">
|
||||||
|
|
|
@ -24,6 +24,6 @@ from osv import osv, fields
|
||||||
class human_resources_configuration(osv.osv_memory):
|
class human_resources_configuration(osv.osv_memory):
|
||||||
_inherit = 'hr.config.settings'
|
_inherit = 'hr.config.settings'
|
||||||
_columns = {
|
_columns = {
|
||||||
'module_hr_payroll_account': fields.boolean('Manage Account Payroll',
|
'module_hr_payroll_account': fields.boolean('Manage Account Payroll',
|
||||||
help ="""It installs the hr_payroll_account module."""),
|
help ="""This installs the module hr_payroll_account."""),
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,10 @@
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//group[@name='additional features']" position="after">
|
<group name="config_payroll" position="after">
|
||||||
<group name="Account Payroll" colspan="4" col="4">
|
<separator string="Account Payroll" colspan="4"/>
|
||||||
<separator string="Account Payroll" colspan="4"/>
|
<field name="module_hr_payroll_account"/>
|
||||||
<field name="module_hr_payroll_account"/>
|
</group>
|
||||||
</group>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -26,10 +26,13 @@ class hr_applicant_settings(osv.osv_memory):
|
||||||
_inherit = ['hr.config.settings', 'fetchmail.config.settings']
|
_inherit = ['hr.config.settings', 'fetchmail.config.settings']
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'fetchmail_applicants': fields.boolean('Create Applicants from an email account',
|
'module_document_ftp': fields.boolean('Index & Track Documents',
|
||||||
fetchmail_model='hr.applicant', fetchmail_name='Incoming Application',
|
help="""Manage your CV's and motivation letter related to all applicants.
|
||||||
help ="""It allow to create applicant from an email account."""),
|
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_server': fields.char('Server', size=256),
|
||||||
'applicants_port': fields.integer('Port'),
|
'applicants_port': fields.integer('Port'),
|
||||||
'applicants_type': fields.selection([
|
'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)"),
|
help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP=995)"),
|
||||||
'applicants_user': fields.char('Username', size=256),
|
'applicants_user': fields.char('Username', size=256),
|
||||||
'applicants_password': fields.char('Password', size=1024),
|
'applicants_password': fields.char('Password', size=1024),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="view_hr_apll_config_settings" model="ir.ui.view">
|
<record id="view_hr_apll_config_settings" model="ir.ui.view">
|
||||||
<field name="name">hr settings for recruitment</field>
|
<field name="name">hr settings for recruitment</field>
|
||||||
<field name="model">hr.config.settings</field>
|
<field name="model">hr.config.settings</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='module_hr_recruitment']" position="after">
|
<field name="module_hr_recruitment" position="after">
|
||||||
<group colspan="2" col="2">
|
<button name="%(hr_recruitment_stage_form_installer)d" string="Create Recruitment Stages"
|
||||||
<label string="Create Recruitment Stages :" />
|
type="action" icon="terp-stage"/>
|
||||||
<button name="%(hr_recruitment_stage_form_installer)d" string="Recruitment Stages" type="action" icon="terp-stage"/>
|
</field>
|
||||||
</group>
|
<group name="config_recruitment" position="after">
|
||||||
</xpath>
|
<separator string="Recruitment" colspan="4"/>
|
||||||
<xpath expr="//field[@name='module_hr_contract']" position="after">
|
<field name="module_document_ftp"/>
|
||||||
<group name="Recruitment" colspan="4" col="4" >
|
<newline/>
|
||||||
<separator string="Recruitment" colspan="4"/>
|
<field name="fetchmail_applicants"/>
|
||||||
<field name="fetchmail_applicants" />
|
<group colspan="2" attrs="{'invisible': [('fetchmail_applicants','=',False)]}">
|
||||||
<group attrs="{'invisible': [('fetchmail_applicants','=',False)]}">
|
<field name="applicants_server"/>
|
||||||
<field name="applicants_server"/>
|
<field name="applicants_type" on_change="onchange_fetchmail('applicants', applicants_type, applicants_is_ssl)"/>
|
||||||
<field name="applicants_type" on_change="onchange_fetchmail('applicants', applicants_type, applicants_is_ssl)"/>
|
<field name="applicants_port"/>
|
||||||
<field name="applicants_port"/>
|
<field name="applicants_is_ssl" on_change="onchange_fetchmail('applicants', applicants_type, applicants_is_ssl)"/>
|
||||||
<field name="applicants_is_ssl" on_change="onchange_fetchmail('applicants', applicants_type, applicants_is_ssl)"/>
|
<field name="applicants_user"/>
|
||||||
<field name="applicants_user"/>
|
<field name="applicants_password" password="True"/>
|
||||||
<field name="applicants_password" password="True"/>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -20,30 +20,29 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import osv, fields
|
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'
|
_inherit = 'hr.config.settings'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'timesheet_range': fields.selection(
|
'timesheet_range': fields.selection([('day','Day'),('week','Week'),('month','Month')],
|
||||||
[('day','Day'),('week','Week'),('month','Month')], 'Timesheet range',
|
'Timesheet Range', help="Periodicity on which you validate your timesheets."),
|
||||||
help="Periodicity on which you validate your timesheets."),
|
'timesheet_max_difference': fields.float('Timesheet Allowed Difference (Hours)',
|
||||||
'timesheet_max_difference': fields.float('Timesheet allowed difference(Hours)',
|
help="""Allowed difference in hours between the sign in/out and the timesheet
|
||||||
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."""),
|
||||||
"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):
|
def get_default_timesheet(self, cr, uid, fields, context=None):
|
||||||
wizard = self.browse(cr, uid, ids)[0]
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
tm_range = wizard.timesheet_range
|
return {
|
||||||
tm_diff = wizard.timesheet_max_difference
|
'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 = self.pool.get('res.users').browse(cr, uid, uid, context)
|
||||||
user.company_id.write({'timesheet_range': tm_range,'timesheet_max_difference': tm_diff})
|
user.company_id.write({
|
||||||
return {}
|
'timesheet_range': config.timesheet_range,
|
||||||
|
'timesheet_max_difference': config.timesheet_max_difference,
|
||||||
|
})
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="view_hr_timehseet_config_settings" model="ir.ui.view">
|
<record id="view_hr_timehseet_config_settings" model="ir.ui.view">
|
||||||
<field name="name">hr settings for timesheets</field>
|
<field name="name">hr settings for timesheets</field>
|
||||||
<field name="model">hr.config.settings</field>
|
<field name="model">hr.config.settings</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='module_hr_timesheet_sheet']" position="after">
|
<field name="module_hr_timesheet_sheet" position="after">
|
||||||
<label string="Create Your Timesheet Accounts :"/>
|
<button name="%(hr_timesheet.action_define_analytic_structure)d" string="Create Your Timesheet Accounts" type="action" icon="terp-folder-green"/>
|
||||||
<button name="%(hr_timesheet.action_define_analytic_structure)d" string="Timesheet Accounts" type="action" icon="terp-folder-green"/>
|
</field>
|
||||||
</xpath>
|
<group name="config_timesheets" position="after">
|
||||||
<xpath expr="//field[@name='module_hr_contract']" position="after">
|
<separator string="Timesheets" colspan="4"/>
|
||||||
<newline/>
|
<field name="timesheet_range"/>
|
||||||
<group name="Timesheets" colspan="4" col="8">
|
<field name="timesheet_max_difference"/>
|
||||||
<separator string="Timesheets" colspan="12"/>
|
</group>
|
||||||
<field name="timesheet_range"/>
|
|
||||||
<field name="timesheet_max_difference"/>
|
|
||||||
</group>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue