[IMP] Clean hr_* module (Still need to done)

bzr revid: mra@mra-laptop-20100703102152-4ulrrzbkorpd7xei
This commit is contained in:
Mustufa Rangwala 2010-07-03 15:51:52 +05:30
parent 91d266a1d6
commit c179005fc7
67 changed files with 833 additions and 814 deletions

View File

@ -21,11 +21,11 @@
{
"name" : "Human Resources",
"version" : "1.1",
"author" : "Tiny",
"category" : "Generic Modules/Human Resources",
"website" : "http://www.openerp.com",
"name": "Human Resources",
"version": "1.1",
"author": "Tiny",
"category": "Generic Modules/Human Resources",
"website": "http://www.openerp.com",
"description": """
Module for human resource management. You can manage:
* Employees and hierarchies : You can define your employee with User and display hierarchies
@ -45,10 +45,11 @@
'hr_installer.xml',
'hr_data.xml',
'board_hr_view.xml',
],
'demo_xml': ['hr_demo.xml',
'hr_department_demo.xml'],
],
'demo_xml': [
'hr_demo.xml',
'hr_department_demo.xml'
],
'test': ['test/test_hr.yml'],
'installable': True,
'active': False,

View File

@ -27,9 +27,8 @@ from tools.translate import _
class hr_employee_category(osv.osv):
_name = "hr.employee.category"
_description = "Employee Category"
_columns = {
'name' : fields.char("Category", size=64, required=True),
'name': fields.char("Category", size=64, required=True),
'parent_id': fields.many2one('hr.employee.category', 'Parent Category', select=True),
'child_ids': fields.one2many('hr.employee.category', 'parent_id', 'Child Categories')
}
@ -37,7 +36,7 @@ class hr_employee_category(osv.osv):
def _check_recursion(self, cr, uid, ids):
level = 100
while len(ids):
cr.execute('select distinct parent_id from hr_employee_category where id IN %s',(tuple(ids),))
cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), ))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
if not level:
return False
@ -54,13 +53,14 @@ class hr_employee_marital_status(osv.osv):
_name = "hr.employee.marital.status"
_description = "Employee Marital Status"
_columns = {
'name' : fields.char('Marital Status', size=30, required=True),
'description' : fields.text('Status Description'),
'name': fields.char('Marital Status', size=30, required=True),
'description': fields.text('Status Description'),
}
hr_employee_marital_status()
class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name,args,context=None):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
res = {}
for emp in self.browse(cr, uid, ids):
res[emp.id] = len(emp.employee_ids or [])
@ -70,19 +70,19 @@ class hr_job(osv.osv):
_description = "Job Description"
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
'expected_employees':fields.integer('Expected Employees', help='Required number of Employees'),
'expected_employees': fields.integer('Expected Employees', help='Required number of Employees'),
'no_of_employee': fields.function(_no_of_employee, method=True, string='No of Employees', type='integer', help='Number of Employees selected'),
'employee_ids':fields.one2many('hr.employee', 'job_id','Employees'),
'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees'),
'description': fields.text('Job Description'),
'requirements':fields.text('Requirements'),
'department_id':fields.many2one('hr.department','Department'),
'requirements': fields.text('Requirements'),
'department_id': fields.many2one('hr.department', 'Department'),
'company_id': fields.many2one('res.company', 'Company'),
'state': fields.selection([('open','Open'),('old','Old'),('recruit','In Recruitement')], 'State', required=True),
'state': fields.selection([('open', 'Open'),('old', 'Old'),('recruit', 'In Recruitement')], 'State', required=True),
}
_defaults = {
'expected_employees': lambda *a: 1,
'expected_employees': 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),
'state': lambda *args: 'open'
'state': 'open'
}
hr_job()
@ -90,17 +90,17 @@ hr_job()
class hr_employee(osv.osv):
_name = "hr.employee"
_description = "Employee"
_inherits = {'resource.resource':"resource_id"}
_inherits = {'resource.resource': "resource_id"}
_columns = {
'country_id' : fields.many2one('res.country', 'Nationality'),
'birthday' : fields.date("Birthday"),
'country_id': fields.many2one('res.country', 'Nationality'),
'birthday': fields.date("Birthday"),
'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
'sinid': fields.char('SIN No', size=32),
'otherid': fields.char('Other ID', size=32),
'gender': fields.selection([('male','Male'),('female','Female')], 'Gender'),
'gender': fields.selection([('male', 'Male'),('female', 'Female')], 'Gender'),
'marital': fields.many2one('hr.employee.marital.status', 'Marital Status'),
'bank_account': fields.char('Bank Account', size=56),
'partner_id' : fields.related('company_id', 'partner_id', type='many2one', relation='res.partner', readonly=True),
'partner_id': fields.related('company_id', 'partner_id', type='many2one', relation='res.partner', readonly=True),
'department_id':fields.many2one('hr.department','Department'),
'address_id': fields.many2one('res.partner.address', 'Working Address'),
'address_home_id': fields.many2one('res.partner.address', 'Home Address'),
@ -109,8 +109,8 @@ class hr_employee(osv.osv):
'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'),
'parent_id': fields.many2one('hr.employee', 'Manager', select=True),
'category_id' : fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'),
'category_id': fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade'),
'coach_id': fields.many2one('res.users', 'Coach'),
'job_id': fields.many2one('hr.job', 'Job'),
@ -123,7 +123,7 @@ class hr_employee(osv.osv):
'rb') .read().encode('base64')
_defaults = {
'active' : 1,
'active': 1,
'photo': _get_photo,
}

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Employee Marital Statusses -->
<record id="hr_employee_marital_status_single" model="hr.employee.marital.status">
<field name="name">Single</field>
@ -14,5 +15,6 @@
<record id="hr_employee_marital_status_widower" model="hr.employee.marital.status">
<field name="name">Widower</field>
</record>
</data>
</openerp>

View File

@ -25,6 +25,8 @@ import tools
class hr_department(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
if not len(ids):
return []
reads = self.read(cr, uid, ids, ['name','parent_id'], context)
@ -36,7 +38,7 @@ class hr_department(osv.osv):
res.append((record['id'], name))
return res
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context):
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
res = self.name_get(cr, uid, ids, context)
return dict(res)
@ -51,13 +53,19 @@ class hr_department(osv.osv):
'manager_id': fields.many2one('res.users', 'Manager', required=True),
'member_ids': fields.many2many('res.users', 'hr_department_user_rel', 'department_id', 'user_id', 'Members'),
}
def _get_members(self,cr, uid, context={}):
mids = self.search(cr, uid, [('manager_id','=',uid)])
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.department', context=c),
}
def _get_members(self,cr, uid, context=None):
mids = self.search(cr, uid, [('manager_id', '=', uid)])
result = {uid:1}
for m in self.browse(cr, uid, mids, context):
for user in m.member_ids:
result[user.id] = 1
return result.keys()
def _check_recursion(self, cr, uid, ids):
level = 100
while len(ids):
@ -78,18 +86,17 @@ hr_department()
class ir_action_window(osv.osv):
_inherit = 'ir.actions.act_window'
def read(self, cr, uid, ids, fields=None, context=None,
load='_classic_read'):
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
if context is None:
context = {}
select = ids
if isinstance(ids, (int, long)):
select = [ids]
res = super(ir_action_window, self).read(cr, uid, select, fields=fields,
context=context, load=load)
res = super(ir_action_window, self).read(cr, uid, select, fields=fields, context=context, load=load)
for r in res:
mystring = 'department_users_get()'
if mystring in (r.get('domain', '[]') or ''):
r['domain'] = r['domain'].replace(mystring, str(
self.pool.get('hr.department')._get_members(cr, uid)))
r['domain'] = r['domain'].replace(mystring, str(self.pool.get('hr.department')._get_members(cr, uid)))
if isinstance(ids, (int, long)):
if res:
return res[0]
@ -103,7 +110,7 @@ class res_users(osv.osv):
_inherit = 'res.users'
_description = 'User'
def _parent_compute(self, cr, uid, ids, name, args, context={}):
def _parent_compute(self, cr, uid, ids, name, args, context=None):
result = {}
obj_dept = self.pool.get('hr.department')
for user_id in ids:
@ -125,10 +132,12 @@ class res_users(osv.osv):
return [('id', 'in', [0])]
return [('id', 'in', child_ids.get(uid,[]))]
def _child_compute(self, cr, uid, ids, name, args, context={}):
def _child_compute(self, cr, uid, ids, name, args, context=None):
obj_dept = self.pool.get('hr.department')
obj_user = self.pool.get('res.users')
result = {}
if context is None:
context = {}
for manager_id in ids:
child_ids = []
mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)])
@ -137,10 +146,9 @@ class res_users(osv.osv):
data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'])
childs = map(lambda x: x['member_ids'], data_dept)
childs = tools.flatten(childs)
childs = obj_user.search(cr, uid, [('id','in',childs),('active','=',True)])
childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)])
if manager_id in childs:
childs.remove(manager_id)
child_ids.extend(tools.flatten(childs))
set = {}
map(set.__setitem__, child_ids, [])
@ -150,7 +158,7 @@ class res_users(osv.osv):
result[manager_id] = child_ids
return result
def _child_search(self, cr, uid, obj, name, args, context):
def _child_search(self, cr, uid, obj, name, args, context=None):
parent = []
for arg in args:
if arg[0] == 'child_ids':
@ -161,9 +169,11 @@ class res_users(osv.osv):
return [('id', 'in', child_ids.get(uid,[]))]
_columns = {
'parent_id': fields.function(_parent_compute, relation='res.users',fnct_search=_parent_search, method=True, string="Managers", type='many2many'),
'parent_id': fields.function(_parent_compute, relation='res.users', fnct_search=_parent_search, method=True, string="Managers", type='many2many'),
'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search, method=True, string="Subordinates", type='many2many'),
'context_department_id': fields.many2one('hr.department', 'Departments'),
}
res_users()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_installer" model="ir.ui.view">
<field name="name">hr.installer.view</field>
<field name="model">hr.installer</field>
@ -7,20 +9,18 @@
<field name="inherit_id" ref="base.res_config_installer"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>
</separator>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<form position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>
</separator>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
</xpath>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">The base Human Resources addon will help you manage your employee roster, but you can enhance it even further by installing a few HR-related applications.</attribute>
</xpath>
</xpath>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">The base Human Resources addon will help you manage your employee roster, but you can enhance it even further by installing a few HR-related applications.</attribute>
</xpath>
<group colspan="8">
<field name="hr_holidays"/>
<field name="hr_expense"/>
@ -51,16 +51,18 @@
<field name="action_id" ref="action_hr_installer"/>
<field name="sequence">3</field>
</record>
<record id="hr_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field>
<field name="name">hr_installer_action_replace</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<record id="hr_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field>
<field name="name">hr_installer_action_replace</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@string='Launch']" position="replace">
<button name="%(action_hr_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/>
</xpath>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -1,32 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem
id="menu_hr_root"
icon="terp-hr"
name="Human Resources"
sequence="15"/>
<menuitem
id="menu_hr_main"
parent="menu_hr_root"
name="Human Resources"
sequence="0"/>
<menuitem
id="menu_hr_configuration"
name="Configuration"
parent="hr.menu_hr_root"
groups="group_hr_manager"
sequence="50" />
<menuitem
id="menu_hr_management"
name="Human Resources"
parent="hr.menu_hr_configuration"
groups="group_hr_manager"
sequence="1" />
<menuitem
id="menu_view_employee_category_configuration_form"
parent="hr.menu_hr_management"
name="Employees"
<menuitem id="menu_hr_root" icon="terp-hr" name="Human Resources" sequence="15"/>
<menuitem id="menu_hr_main" parent="menu_hr_root" name="Human Resources" sequence="0"/>
<menuitem id="menu_hr_configuration" name="Configuration" parent="hr.menu_hr_root" groups="group_hr_manager" sequence="50" />
<menuitem id="menu_hr_management" name="Human Resources" parent="hr.menu_hr_configuration" groups="group_hr_manager" sequence="1" />
<menuitem id="menu_view_employee_category_configuration_form" parent="hr.menu_hr_management" name="Employees"
sequence="1"/>
<!--
@ -42,50 +22,50 @@
<form string="Employee">
<group colspan="4" col="8">
<group colspan="6" col="6">
<field colspan="6" name="name" />
<field name="user_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active" groups="base.group_extended"/>
<newline/>
<field name="parent_id" />
<field name="coach_id" />
<field colspan="6" name="name" />
<field name="user_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active" groups="base.group_extended"/>
<newline/>
<field name="parent_id" />
<field name="coach_id" />
</group>
<group colspan="2" col="1">
<field name="photo" widget='image' nolabel="1"/>
<field name="photo" widget='image' nolabel="1"/>
</group>
</group>
<notebook colspan="6">
<page string="Personal Information">
<group col="2" colspan="2">
<separator colspan="2" string="Social IDs"/>
<field name="ssnid"/>
<field name="sinid" groups="base.group_extended"/>
<field name="otherid" groups="base.group_extended"/>
<separator colspan="2" string="Social IDs"/>
<field name="ssnid"/>
<field name="sinid" groups="base.group_extended"/>
<field name="otherid" groups="base.group_extended"/>
</group>
<group col="2" colspan="2">
<separator string="Status" colspan="2"/>
<field name="gender"/>
<field name="marital" widget="selection"/>
<field name="country_id"/>
<field name="birthday"/>
<separator string="Status" colspan="2"/>
<field name="gender"/>
<field name="marital" widget="selection"/>
<field name="country_id"/>
<field name="birthday"/>
</group>
<group col="2" colspan="2">
<separator string="Contact Information" colspan="2"/>
<field name="address_home_id" colspan="2"/>
<field name="partner_id" invisible="1" />
<field name="address_id" colspan="2" domain="[('partner_id', '=', partner_id)]"/>
<field name="work_phone"/>
<field name="work_email" widget="email" />
<field name="work_location"/>
<separator string="Contact Information" colspan="2"/>
<field name="address_home_id" colspan="2"/>
<field name="partner_id" invisible="1" />
<field name="address_id" colspan="2" domain="[('partner_id', '=', partner_id)]"/>
<field name="work_phone"/>
<field name="work_email" widget="email" />
<field name="work_location"/>
</group>
<group col="2" colspan="2">
<separator string="Position" colspan="2"/>
<field name="job_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<field name="category_id" />
<!--<separator string="Managers" colspan="2"/>
<field name="parent_id" />
<field name="coach_id" />-->
<separator string="Position" colspan="2"/>
<field name="job_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<field name="category_id" />
<!--<separator string="Managers" colspan="2"/>
<field name="parent_id" />
<field name="coach_id" />-->
</group>
</page>
<page string="Notes">
@ -112,29 +92,30 @@
</tree>
</field>
</record>
<record id="view_employee_filter" model="ir.ui.view">
<field name="name">Employees</field>
<field name="model">hr.employee</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Employees">
<filter icon="terp-personal-" domain="[('active','=',False)]" string="Unactive"
groups="base.group_extended"/>
<filter icon="terp-personal-" domain="[('active','=',False)]" string="Unactive" groups="base.group_extended"/>
<field name="name"/>
<field name="department_id" widget="selection"/>
<field name="job_id" widget="selection"/>
<field name="parent_id"/>
<newline />
<group expand="0" string="Group By...">
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Coach" icon="terp-personal" domain="[]" context="{'group_by':'coach_id'}" groups="base.group_extended"/>
<separator orientation="vertical" />
<filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Coach" icon="terp-personal" domain="[]" context="{'group_by':'coach_id'}" groups="base.group_extended"/>
<separator orientation="vertical" />
<filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
</group>
</search>
</field>
</record>
<record id="open_view_employee_tree" model="ir.actions.act_window">
<field name="name">Employees Structure</field>
<field name="res_model">hr.employee</field>
@ -153,7 +134,8 @@
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_employee_filter"/>
</record>
<record id="open_view_employee_list_my" model="ir.actions.act_window">
<record id="open_view_employee_list_my" model="ir.actions.act_window">
<field name="name">Employees</field>
<field name="res_model">hr.employee</field>
<field name="view_type">form</field>
@ -162,17 +144,14 @@
<field name="view_id" ref="view_employee_tree"/>
<field name="search_view_id" ref="view_employee_filter"/>
</record>
<menuitem
action="open_view_employee_list_my"
id="menu_open_view_employee_list_my"
sequence="3"
parent="menu_hr_main"/>
<menuitem action="open_view_employee_list_my" id="menu_open_view_employee_list_my" sequence="3" parent="menu_hr_main"/>
<!--
=======================
Employee marital status
======================= -->
=======================
-->
<record id="hr_hr_employee_marital_status_form" model="ir.ui.view">
<field name="name">hr.hr.employee.marital.status</field>
@ -194,17 +173,15 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem
action="action_hr_marital_status"
id="hr_menu_marital_status"
<menuitem action="action_hr_marital_status" id="hr_menu_marital_status"
parent="hr.menu_view_employee_category_configuration_form" sequence="3"/>
<!--
=======================
Employee architecture
=======================
-->
<record id="view_partner_tree2" model="ir.ui.view">
<field name="name">hr.employee.tree</field>
<field name="model">hr.employee</field>
@ -216,10 +193,10 @@
<field name="ssnid"/>
<field name="user_id"/>
<field name="address_id"/>
</tree>
</field>
</record>
<record id="action2" model="ir.actions.act_window">
<field name="name">Employee Hierarchy</field>
<field name="type">ir.actions.act_window</field>
@ -228,6 +205,7 @@
<field name="view_type">tree</field>
<field name="view_id" ref="view_partner_tree2"/>
</record>
<ir_set>
<field eval="'action'" name="key"/>
<field eval="'client_action_multi'" name="key2"/>
@ -255,6 +233,7 @@
</form>
</field>
</record>
<record id="view_employee_category_list" model="ir.ui.view">
<field name="name">hr.employee.category.list</field>
<field name="model">hr.employee.category</field>
@ -267,6 +246,7 @@
</tree>
</field>
</record>
<record id="view_employee_category_tree" model="ir.ui.view">
<field name="name">hr.employee.category.tree</field>
<field name="model">hr.employee.category</field>
@ -278,6 +258,7 @@
</tree>
</field>
</record>
<record id="open_view_categ_form" model="ir.actions.act_window">
<field name="name">Categories of Employee</field>
<field name="res_model">hr.employee.category</field>
@ -285,10 +266,8 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem action="open_view_categ_form"
id="menu_view_employee_category_form"
parent="menu_view_employee_category_configuration_form" sequence="1"
groups="base.group_extended"/>
<menuitem action="open_view_categ_form" id="menu_view_employee_category_form"
parent="menu_view_employee_category_configuration_form" sequence="1" groups="base.group_extended"/>
<record id="open_view_categ_tree" model="ir.actions.act_window">
<field name="name">Categories structure</field>
@ -316,9 +295,7 @@
<field eval="True" name="object"/>
</record>
<menuitem
action="open_view_categ_tree"
groups="base.group_extended"
<menuitem action="open_view_categ_tree" groups="base.group_extended"
id="menu_view_employee_category_tree" parent="hr.menu_view_employee_category_form"/>
<record id="view_hr_job_form" model="ir.ui.view">
@ -328,11 +305,11 @@
<field name="arch" type="xml">
<form string="Job">
<group col="6" colspan="4">
<field name="name" />
<field name="department_id" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="expected_employees"/>
<field name="no_of_employee"/>
<field name="name" />
<field name="department_id" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="expected_employees"/>
<field name="no_of_employee"/>
</group>
<newline/>
<notebook colspan="4">
@ -350,6 +327,7 @@
</form>
</field>
</record>
<record id="view_hr_job_tree" model="ir.ui.view">
<field name="name">hr.job.tree</field>
<field name="model">hr.job</field>
@ -364,35 +342,28 @@
</tree>
</field>
</record>
<record id="view_job_filter" model="ir.ui.view">
<field name="name">Job</field>
<field name="model">hr.job</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Jobs">
<filter icon="terp-check"
domain="[('state','in',('open','recruit'))]"
string="Current"
<filter icon="terp-check" domain="[('state','in',('open','recruit'))]" string="Current"
help="Open and in recruitment positions"/>
<filter icon="terp-personal+"
domain="[('state','=','recruit')]"
string="Recruitment"
<filter icon="terp-personal+" domain="[('state','=','recruit')]" string="Recruitment"
help="In Recruitment"/>
<filter icon="terp-camera_test"
domain="[('state','=','open')]"
string="Open"
<filter icon="terp-camera_test" domain="[('state','=','open')]" string="Open"
help="Open Positions"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="department_id" widget="selection">
<filter icon="terp-gtk-select-all"
domain="[('department_id','=',context.get('department_id',False))]"
help="My Departments Jobs"/>
<field name="department_id" widget="selection">
<filter icon="terp-gtk-select-all" domain="[('department_id','=',context.get('department_id',False))]" help="My Departments Jobs"/>
</field>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_hr_job">
<field name="name">Job Positions</field>
<field name="res_model">hr.job</field>
@ -400,14 +371,8 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem
name="Recruitment"
id="base.menu_crm_case_job_req_main"
parent="menu_hr_root"/>
<menuitem
parent="base.menu_crm_case_job_req_main"
id="menu_hr_job"
action="action_hr_job" sequence="2"/>
<menuitem name="Recruitment" id="base.menu_crm_case_job_req_main" parent="menu_hr_root"/>
<menuitem parent="base.menu_crm_case_job_req_main" id="menu_hr_job" action="action_hr_job" sequence="2"/>
</data>
</openerp>

View File

@ -23,29 +23,28 @@ from osv import fields, osv
class hr_installer(osv.osv_memory):
_name = 'hr.installer'
_inherit = 'res.config.installer'
_columns = {
# Human Resources Management
'hr_holidays':fields.boolean('Holidays / Leaves Management',
'hr_holidays': fields.boolean('Holidays / Leaves Management',
help="Tracks employee leaves allocations, requests and planning."
"\n\nCan also plug into OpenERP's agendas and calendars "
"applications in order to display accepted leaves requests on"
" OpenERP's calendars."),
'hr_expense':fields.boolean('Expenses',
'hr_expense': fields.boolean('Expenses',
help="Tracks and manages employee expenses, and can "
"automatically re-invoice clients if the expenses are "
"project-related."),
'hr_recruitment':fields.boolean('Recruitment Process',
'hr_recruitment': fields.boolean('Recruitment Process',
help="Helps you manage and streamline your recruitment process."),
'hr_timesheet_sheet':fields.boolean('Timesheets',
help="Tracks and helps employees encode and validate timesheets "
"and attendance."),
'hr_contract':fields.boolean("Employee's Contracts",
'hr_contract': fields.boolean("Employee's Contracts",
help="Extends employee profiles to help manage their contracts."),
'hr_evaluation':fields.boolean('Periodic Evaluations',
'hr_evaluation': fields.boolean('Periodic Evaluations',
help="Lets you create and manage the periodic evaluation and "
"performance review of employees."),
'hr_attendance':fields.boolean('Attendances (Sign In/Out)',
'hr_attendance': fields.boolean('Attendances (Sign In/Out)',
help="Simplifies the management of employee attendances."),
}
_defaults = {
@ -55,4 +54,4 @@ class hr_installer(osv.osv_memory):
hr_installer()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="group_hr_manager" model="res.groups">
<field name="name">Human Resources / Manager</field>
</record>
<record id="group_hr_user" model="res.groups">
<field name="name">Human Resources / User</field>
</record>
</data>
</openerp>

View File

@ -26,7 +26,6 @@
'category': 'Generic Modules/Human Resources',
'description': """
This module aims to manage employee's attendances.
Keeps account of the attendances of the employees on the basis of the
actions(Sign in/Sign out) performed by them.
""",
@ -42,7 +41,7 @@
'wizard/hr_attendance_byweek_view.xml',
'wizard/hr_attendance_error_view.xml',
'wizard/hr_attendance_sign_in_out_view.xml',
],
],
'demo_xml': ['hr_attendance_demo.xml'],
'test': ['test/test_hr_attendance.yml'],
'installable': True,

View File

@ -19,7 +19,6 @@
#
##############################################################################
from mx import DateTime
import time
from osv import fields, osv
@ -29,16 +28,16 @@ class hr_action_reason(osv.osv):
_name = "hr.action.reason"
_description = "Action Reason"
_columns = {
'name' : fields.char('Reason', size=64, required=True, help='Specifies the reason for Signing In/Signing Out.'),
'action_type' : fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')], "Action's type"),
'name': fields.char('Reason', size=64, required=True, help='Specifies the reason for Signing In/Signing Out.'),
'action_type': fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')], "Action's type"),
}
_defaults = {
'action_type' : lambda *a: 'sign_in',
'action_type': 'sign_in',
}
hr_action_reason()
def _employee_get(obj, cr, uid, context=None):
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)])
if ids:
return ids[0]
return False
@ -51,18 +50,18 @@ class hr_attendance(osv.osv):
res = dict.fromkeys(ids, '')
for obj in self.browse(cr, uid, ids, context=context):
res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S'))
return res
_columns = {
'name' : fields.datetime('Date', required=True, select=1),
'action' : fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'),('action','Action')], 'Action', required=True),
'action_desc' : fields.many2one("hr.action.reason", "Action reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'),
'employee_id' : fields.many2one('hr.employee', "Employee's Name", required=True, select=True),
'day' : fields.function(_day_compute, method=True, type='char', string='Day', store=True, select=1, size=32),
'name': fields.datetime('Date', required=True, select=1),
'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True),
'action_desc': fields.many2one("hr.action.reason", "Action reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'),
'employee_id': fields.many2one('hr.employee', "Employee's Name", required=True, select=True),
'day': fields.function(_day_compute, method=True, type='char', string='Day', store=True, select=1, size=32),
}
_defaults = {
'name' : lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'employee_id' : _employee_get,
'name': time.strftime('%Y-%m-%d %H:%M:%S'),
'employee_id': _employee_get,
}
def _altern_si_so(self, cr, uid, ids):
@ -75,7 +74,6 @@ class hr_attendance(osv.osv):
and name <= (select name from hr_attendance where id=%s)
order by name desc
limit 2 '''
cr.execute(sql,(id,id))
atts = cr.fetchall()
if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])):
@ -113,19 +111,18 @@ class hr_employee(osv.osv):
'state': fields.function(_state, method=True, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'),
}
def _action_check(self, cr, uid, emp_id, dt=False,context={}):
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
cr.execute('select max(name) from hr_attendance where employee_id=%s', (emp_id,))
res = cr.fetchone()
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S'))))
def attendance_action_change(self, cr, uid, ids, type='action', context={}, dt=False, *args):
def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args):
id = False
warning_sign = 'sign'
#Special case when button calls this method :type=context
if isinstance(type,dict):
if isinstance(type, dict):
type = type.get('type','action')
if type == 'sign_in':
warning_sign = "Sign In"
elif type == 'sign_out':
@ -135,15 +132,15 @@ class hr_employee(osv.osv):
if not self._action_check(cr, uid, emp['id'], dt, context):
raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the administrator to correct attendances.')%(warning_sign,))
res = {'action' : type, 'employee_id' : emp['id']}
res = {'action': type, 'employee_id': emp['id']}
if dt:
res['name'] = dt
id = self.pool.get('hr.attendance').create(cr, uid, res, context=context)
if type != 'action':
return id
return True
hr_employee()

View File

@ -7,100 +7,120 @@
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance2" model="hr.attendance">
<field eval="time.strftime('%Y-%m-01 11:51')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance3" model="hr.attendance">
<field eval="time.strftime('%Y-%m-02 12:47')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance4" model="hr.attendance">
<field eval="time.strftime('%Y-%m-02 19:53')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance5" model="hr.attendance">
<field eval="time.strftime('%Y-%m-03 07:32')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance6" model="hr.attendance">
<field eval="time.strftime('%Y-%m-03 12:32')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance7" model="hr.attendance">
<field eval="time.strftime('%Y-%m-04 14:01')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance8" model="hr.attendance">
<field eval="time.strftime('%Y-%m-04 17:21')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance9" model="hr.attendance">
<field eval="time.strftime('%Y-%m-05 09:10')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance10" model="hr.attendance">
<field eval="time.strftime('%Y-%m-05 12:42')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance11" model="hr.attendance">
<field eval="time.strftime('%Y-%m-06 13:10')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance12" model="hr.attendance">
<field eval="time.strftime('%Y-%m-06 18:34')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance13" model="hr.attendance">
<field eval="time.strftime('%Y-%m-07 08:21')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance14" model="hr.attendance">
<field eval="time.strftime('%Y-%m-07 18:21')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance15" model="hr.attendance">
<field eval="time.strftime('%Y-%m-08 08:21')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance16" model="hr.attendance">
<field eval="time.strftime('%Y-%m-08 12:54')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance17" model="hr.attendance">
<field eval="time.strftime('%Y-%m-09 13:32')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance18" model="hr.attendance">
<field eval="time.strftime('%Y-%m-09 19:31')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance19" model="hr.attendance">
<field eval="time.strftime('%Y-%m-10 07:10')" name="name"/>
<field name="action">sign_in</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
<record id="attendance20" model="hr.attendance">
<field eval="time.strftime('%Y-%m-10 12:34')" name="name"/>
<field name="action">sign_out</field>
<field name="employee_id" ref="hr.employee1"/>
</record>
</data>
</openerp>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False" id="attendance_error_report" keyword="client_print_multi" menu="False" model="hr.employee" multi="True" name="report.hr.timesheet.attendance.error" rml="hr_attendance/report/attendance_errors.rml" string="Attendance Error Report"/>
</data>
</openerp>

View File

@ -8,13 +8,14 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Employee attendance">
<field name="employee_id" select="1"/>
<field name="name" select="1"/>
<field name="action" select="1"/>
<field name="action_desc" select="1"/>
<field name="employee_id" />
<field name="name" />
<field name="action" />
<field name="action_desc" />
</form>
</field>
</record>
<record id="view_attendance_tree" model="ir.ui.view">
<field name="name">hr.attendance.tree</field>
<field name="model">hr.attendance</field>
@ -51,9 +52,9 @@
<filter icon="terp-stock_align_left_24" string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" />
<filter icon="terp-go-today" string="Today" domain="[('name::date','=',current_date)]" />
<separator orientation="vertical"/>
<field name="employee_id" select="1" />
<field name="name" select="1" />
<field name="action" select="1" />
<field name="employee_id" />
<field name="name" />
<field name="action" />
<newline/>
<group expand="0" string="Group By...">
<filter name="employee" string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
@ -74,12 +75,8 @@
<!--<menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root"
groups="group_hr_attendance"/>-->
<menuitem
id="menu_hr_time_tracking"
name="Time Tracking"
parent="hr.menu_hr_root" sequence="3"/>
<menuitem action="open_view_attendance" id="menu_open_view_attendance"
parent="menu_hr_time_tracking" groups="hr.group_hr_manager" sequence="3"/>
<menuitem id="menu_hr_time_tracking" name="Time Tracking" parent="hr.menu_hr_root" sequence="3"/>
<menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_time_tracking" groups="hr.group_hr_manager" sequence="3"/>
<record id="edit_attendance_reason" model="ir.ui.view">
<field name="name">hr.action.reason.form</field>
@ -87,11 +84,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Define attendance reason">
<field colspan="4" name="name" select="1"/>
<field name="action_type" select="1"/>
<field colspan="4" name="name" />
<field name="action_type" />
</form>
</field>
</record>
<record id="view_attendance_reason" model="ir.ui.view">
<field name="name">hr.action.reason.tree</field>
<field name="model">hr.action.reason</field>
@ -103,6 +101,7 @@
</tree>
</field>
</record>
<record id="open_view_attendance_reason" model="ir.actions.act_window">
<field name="name">Attendance Reasons</field>
<field name="type">ir.actions.act_window</field>
@ -111,6 +110,7 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_attendance_reason"/>
</record>
<menuitem sequence="9" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Leaves"/>
<menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_open_view_attendance_reason_config"/>

View File

@ -13,9 +13,7 @@
groups="group_hr_attendance"/>-->
<!--Time Tracking menu for Project Management-->
<menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/>
<menuitem
id="base.menu_project_management_time_tracking"
name="Time Tracking"
<menuitem id="base.menu_project_management_time_tracking" name="Time Tracking"
parent="base.menu_main_pm" sequence="3"/>
<!--<menuitem action="hr_attendance.si_so" id="menu_project_management_si_so" parent="base.menu_project_management_time_tracking" type="wizard" sequence="9"/>
-->

View File

@ -19,13 +19,13 @@
#
##############################################################################
import time
from report import report_sxw
import pooler
import datetime
class attendance_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(attendance_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
@ -80,14 +80,13 @@ class attendance_print(report_sxw.rml_parse):
total2 += r['delay']
result_dict = {
'total' : total and str(total).split('.')[0],
'total2' : total2 and str(total2).split('.')[0]
'total': total and str(total).split('.')[0],
'total2': total2 and str(total2).split('.')[0]
}
# return (self._sign(total),total2 and self._sign(total2))
return [result_dict]
report_sxw.report_sxw('report.hr.attendance.error', 'hr.employee', 'addons/hr_attendance/report/attendance_errors.rml',parser=attendance_print, header=2)
report_sxw.report_sxw('report.hr.attendance.error', 'hr.employee', 'addons/hr_attendance/report/attendance_errors.rml', parser=attendance_print, header=2)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,7 +30,7 @@ from report.interface import report_rml
from report.interface import toxml
one_day = DateTime.RelativeDateTime(days=1)
month2name = [0,'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
month2name = [0, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
def hour2str(h):
hours = int(h)
@ -38,7 +38,10 @@ def hour2str(h):
return '%02dh%02d' % (hours, minutes)
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context):
def create_xml(self, cr, uid, ids, datas, context=None):
if context is None:
context = {}
month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1)
user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year]
for employee_id in ids:
@ -67,7 +70,7 @@ class report_custom(report_rml):
if attendences and attendences[0]['action'] == 'sign_out':
attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
if attendences and attendences[-1]['action'] == 'sign_in':
attendences.append({'name' : tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
# sum up the attendances' durations
for att in attendences:
dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
@ -88,7 +91,6 @@ class report_custom(report_rml):
%s
</report>
''' % '\n'.join(user_xml)
return xml
report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl')

View File

@ -22,7 +22,7 @@
from mx import DateTime
from mx.DateTime import now
import netsvc
import pooler
from report.interface import report_rml
@ -35,13 +35,12 @@ def to_hour(h):
return int(h), int(round((h - int(h)) * 60, 0))
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context):
def create_xml(self, cr, uid, ids, datas, context=None):
start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d')
end_date = DateTime.strptime(datas['form']['end_date'], '%Y-%m-%d')
first_monday = start_date - DateTime.RelativeDateTime(days=start_date.day_of_week)
last_monday = end_date + DateTime.RelativeDateTime(days=7 - end_date.day_of_week)
if last_monday < first_monday:
first_monday, last_monday = last_monday, first_monday
@ -73,9 +72,9 @@ class report_custom(report_rml):
# Fake sign ins/outs at week ends, to take attendances across week ends into account
# XXX this is wrong for the first sign-in ever and the last sign out to this date
if attendances and attendances[0]['action'] == 'sign_out':
attendances.insert(0, {'name': monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
attendances.insert(0, {'name': monday.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_in'})
if attendances and attendances[-1]['action'] == 'sign_in':
attendances.append({'name' : n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
attendances.append({'name': n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_out'})
# sum up the attendances' durations
for att in attendances:
dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="group_hr_attendance" model="res.groups">
<field name="name">Human Resources / Attendances User</field>
</record>
</data>
<data noupdate="1">
<record id="group_hr_attendance" model="res.groups">
<field name="name">Human Resources / Attendances User</field>
</record>
</data>
</openerp>

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
@ -26,16 +27,17 @@ class hr_attendance_bymonth(osv.osv_memory):
_name = 'hr.attendance.month'
_description = 'Print Monthly Attendance Report'
_columns = {
'month': fields.selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')],
'Month', required=True),
'month': fields.selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], 'Month', required=True),
'year': fields.integer('Year', required=True)
}
_defaults = {
'month': lambda * a: time.gmtime()[1],
'year': lambda * a: time.gmtime()[0],
'month': time.gmtime()[1],
'year': time.gmtime()[0],
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {
'ids': [],
'model': 'hr.employee',
@ -49,4 +51,4 @@ class hr_attendance_bymonth(osv.osv_memory):
hr_attendance_bymonth()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -9,9 +9,9 @@
<field name="arch" type="xml">
<form string="Print Attendance Report Monthly">
<group col="4" colspan="6">
<field name="month"/>
<field name="year"/>
<newline/>
<field name="month"/>
<field name="year"/>
<newline/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
@ -42,4 +42,4 @@
</record>
</data>
</openerp>
</openerp>

View File

@ -28,11 +28,11 @@ class hr_attendance_byweek(osv.osv_memory):
_columns = {
'init_date': fields.date('Starting Date', required=True),
'end_date': fields.date('Ending Date', required=True)
}
}
_defaults = {
'init_date': lambda *a: time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'),
}
'init_date': time.strftime('%Y-%m-%d'),
'end_date': time.strftime('%Y-%m-%d'),
}
def print_report(self, cr, uid, ids, context=None):
datas = {
@ -47,4 +47,4 @@ class hr_attendance_byweek(osv.osv_memory):
}
hr_attendance_byweek()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -9,10 +9,10 @@
<field name="arch" type="xml">
<form string="Print Attendance Report Weekly">
<group col="4" colspan="6">
<separator string="Select a starting and a end date" colspan="4"/>
<field name="init_date"/>
<field name="end_date"/>
<newline/>
<separator string="Select a starting and a end date" colspan="4"/>
<field name="init_date"/>
<field name="end_date"/>
<newline/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
@ -43,4 +43,4 @@
</record>
</data>
</openerp>
</openerp>

View File

@ -31,15 +31,16 @@ class hr_attendance_error(osv.osv_memory):
'init_date': fields.date('Starting Date', required=True),
'end_date': fields.date('Ending Date', required=True),
'max_delay': fields.integer('Max. Delay (Min)', required=True)
}
}
_defaults = {
'init_date': lambda *a: time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'),
'init_date': time.strftime('%Y-%m-%d'),
'end_date': time.strftime('%Y-%m-%d'),
'max_delay': 120,
}
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
emp_ids = []
data_error = self.read(cr, uid, ids)[0]
date_from = data_error['init_date']
@ -67,4 +68,4 @@ class hr_attendance_error(osv.osv_memory):
hr_attendance_error()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -9,12 +9,12 @@
<field name="arch" type="xml">
<form string="Print Attendance Report Error">
<group col="4" colspan="6">
<separator string="Analysis Information" colspan="4"/>
<field name="init_date"/>
<field name="end_date"/>
<field name="max_delay"/>
<label string="Bellow this delay, the error is considered to be voluntary" colspan="2"/>
<newline/>
<separator string="Analysis Information" colspan="4"/>
<field name="init_date"/>
<field name="end_date"/>
<field name="max_delay"/>
<label string="Bellow this delay, the error is considered to be voluntary" colspan="2"/>
<newline/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
@ -45,4 +45,4 @@
</record>
</data>
</openerp>
</openerp>

View File

@ -20,7 +20,6 @@
##############################################################################
import time
import netsvc
from osv import osv, fields
from tools.translate import _
@ -31,8 +30,11 @@ class hr_si_so_ask(osv.osv_memory):
'name': fields.char('Employees name', size=32, required=True, readonly=True),
'last_time': fields.datetime('Your last sign out', required=True),
'emp_id': fields.char('Empoyee ID', size=32, required=True, readonly=True),
}
}
def _get_empname(self, cr, uid, context=None):
if context is None:
context = {}
emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0].name
@ -114,7 +116,7 @@ class hr_sign_in_out(osv.osv_memory):
data = self.read(cr, uid, ids, [])[0]
att_obj = self.pool.get('hr.attendance')
emp_id = data['emp_id']
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc')
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action', '!=', 'action')], limit=1, order='name desc')
last_att = att_obj.browse(cr, uid, att_id, context=context)
if last_att:
last_att = last_att[0]
@ -152,11 +154,8 @@ class hr_sign_in_out(osv.osv_memory):
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past'))
self.pool.get('hr.attendance').create(cr, uid, {
'name': data['last_time'],
'action': 'sign_out',
'employee_id': emp_id
})
self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out',
'employee_id': emp_id})
try:
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
except:

View File

@ -8,9 +8,9 @@
<field name="arch" type="xml">
<form string="Sign in / Sign out">
<group colspan="4" >
<separator string="You are now ready to sign in or out of the attendance follow up" colspan="4" />
<field name="name" />
<field name="state" />
<separator string="You are now ready to sign in or out of the attendance follow up" colspan="4" />
<field name="name" />
<field name="state" />
</group>
<separator colspan="4"/>
<group colspan="4" col="6">
@ -45,8 +45,7 @@
<field name="target">new</field>
</record>
<menuitem action="action_hr_attendance_sigh_in_out"
id="menu_hr_attendance_sigh_in_out"
<menuitem action="action_hr_attendance_sigh_in_out" id="menu_hr_attendance_sigh_in_out"
parent="menu_hr_time_tracking" sequence="4"/>
<record id="view_hr_attendance_so_ask" model="ir.ui.view">
@ -56,9 +55,9 @@
<field name="arch" type="xml">
<form string="hr.sign.out.ask">
<group colspan="4" >
<separator string="You did not sign out the last time. Please enter the date and time you signed out." colspan="4" />
<field name="name" />
<field name="last_time" string="Your last sign out" />
<separator string="You did not sign out the last time. Please enter the date and time you signed out." colspan="4" />
<field name="name" />
<field name="last_time" string="Your last sign out" />
</group>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
@ -75,9 +74,9 @@
<field name="arch" type="xml">
<form string="hr.sign.in.out.ask">
<group colspan="4" >
<separator string="You did not sign in the last time. Please enter the date and time you signed in." colspan="4" />
<field name="name" />
<field name="last_time" string="Your last sign in" />
<separator string="You did not sign in the last time. Please enter the date and time you signed in." colspan="4" />
<field name="name" />
<field name="last_time" string="Your last sign in" />
</group>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
@ -87,6 +86,5 @@
</field>
</record>
</data>
</openerp>

View File

@ -29,7 +29,6 @@
* Martial status,
* Security number,
* Place of birth, birth date, ...
You can assign several contracts per employee.
""",
'author': 'Tiny',
@ -40,7 +39,7 @@
'security/hr_contract_security.xml',
'security/ir.model.access.csv',
'hr_contract_view.xml'
],
],
'demo_xml': [],
'test': ['test/test_hr_contract.yml'],
'installable': True,

View File

@ -34,7 +34,7 @@ class hr_employee(osv.osv):
'vehicle': fields.char('Company Vehicle', size=64),
'vehicle_distance': fields.integer('Home-Work Distance', help="In kilometers"),
'contract_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'),
}
}
hr_employee()
#Contract wage type period name
@ -44,10 +44,10 @@ class hr_contract_wage_type_period(osv.osv):
_columns = {
'name': fields.char('Period Name', size=50, required=True, select=True),
'factor_days': fields.float('Hours in the period', digits=(12,4), required=True, help='This field is used by the timesheet system to compute the price of an hour of work wased on the contract of the employee')
}
}
_defaults = {
'factor_days': lambda *args: 168.0
}
'factor_days': 168.0
}
hr_contract_wage_type_period()
#Contract wage type (hourly, daily, monthly, ...)
@ -55,15 +55,15 @@ class hr_contract_wage_type(osv.osv):
_name = 'hr.contract.wage.type'
_description = 'Wage Type'
_columns = {
'name' : fields.char('Wage Type Name', size=50, required=True, select=True),
'period_id' : fields.many2one('hr.contract.wage.type.period', 'Wage Period', required=True),
'type' : fields.selection([('gross','Gross'), ('net','Net')], 'Type', required=True),
'name': fields.char('Wage Type Name', size=50, required=True, select=True),
'period_id': fields.many2one('hr.contract.wage.type.period', 'Wage Period', required=True),
'type': fields.selection([('gross','Gross'), ('net','Net')], 'Type', required=True),
'factor_type': fields.float('Factor for hour cost', digits=(12,4), required=True, help='This field is used by the timesheet system to compute the price of an hour of work wased on the contract of the employee')
}
}
_defaults = {
'type' : lambda *a : 'gross',
'factor_type': lambda *args: 1.8
}
'type': 'gross',
'factor_type': 1.8
}
hr_contract_wage_type()
@ -93,10 +93,11 @@ class hr_contract(osv.osv):
'advantages_net': fields.float('Net Advantages Value', digits=(16,2)),
'advantages_gross': fields.float('Gross Advantages Value', digits=(16,2)),
'notes': fields.text('Notes'),
}
}
_defaults = {
'date_start' : lambda *a : time.strftime("%Y-%m-%d"),
}
'date_start': time.strftime("%Y-%m-%d"),
}
hr_contract()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,6 +19,7 @@
<field name="type">gross</field>
<field name="period_id" ref="hr_contract_wage_type_period_monthly"/>
</record>
<record id="hr_contract_monthly_net" model="hr.contract.wage.type">
<field name="name">Monthly Net Wage</field>
<field name="type">net</field>

View File

@ -37,12 +37,12 @@
<field name="arch" type="xml">
<search string="Search Wage Type">
<group col='15' colspan='4'>
<field name="name"/>
<field name="type"/>
<field name="name"/>
<field name="type"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Period" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Period" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'period_id'}"/>
</group>
</search>
</field>
@ -58,7 +58,6 @@
</record>
<menuitem id="next_id_56" name="Contract" parent="hr.menu_hr_management" sequence="5"/>
<menuitem action="action_hr_contract_wage_type" id="hr_menu_contract_wage_type" parent="next_id_56"/>
<record id="hr_contract_wage_type_period_view_form" model="ir.ui.view">
@ -80,7 +79,7 @@
<field name="arch" type="xml">
<search string="Search Wage Period">
<group col='15' colspan='4'>
<field name="name"/>
<field name="name"/>
</group>
</search>
</field>
@ -94,12 +93,9 @@
<field name="search_view_id" ref="hr_contract_wage_type_period_view_search"/>
</record>
<menuitem
action="action_hr_contract_wage_type_period"
id="hr_menu_contract_wage_type_period"
<menuitem action="action_hr_contract_wage_type_period" id="hr_menu_contract_wage_type_period"
parent="hr_contract.next_id_56"/>
<record id="hr_hr_employee_view_form2" model="ir.ui.view">
<field name="name">hr.hr.employee.view.form2</field>
<field name="model">hr.employee</field>
@ -108,20 +104,20 @@
<notebook position="inside">
<page string="Miscelleanous">
<group colspan="2" col="2">
<separator string="Personal Info" colspan="2"/>
<field name="bank_account"/>
<field name="place_of_birth"/>
<field name="children"/>
<separator string="Personal Info" colspan="2"/>
<field name="bank_account"/>
<field name="place_of_birth"/>
<field name="children"/>
</group>
<group colspan="2" col="2">
<separator string="Job Info" colspan="2"/>
<field name="manager" select="1"/>
<field name="vehicle" select="1"/>
<field name="vehicle_distance" select="1"/>
<separator string="Job Info" colspan="2"/>
<field name="manager" />
<field name="vehicle" />
<field name="vehicle_distance" />
</group>
<group colspan="2" col="2">
<separator string="Others Info" colspan="2"/>
<field name="medic_exam" select="1"/>
<separator string="Others Info" colspan="2"/>
<field name="medic_exam" />
</group>
</page>
</notebook>
@ -135,14 +131,14 @@
<field name="arch" type="xml">
<search string="Search Contract">
<group col='15' colspan='4'>
<field name="name"/>
<field name="employee_id"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="name"/>
<field name="employee_id"/>
<field name="date_start"/>
<field name="date_end"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Wage Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'wage_type_id'}"/>
<filter string="Wage Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'wage_type_id'}"/>
</group>
</search>
</field>
@ -155,26 +151,26 @@
<field name="arch" type="xml">
<form string="Contract">
<group colspan="3" col="6">
<field name="name" select="1"/>
<field name="employee_id" select="1"/>
<field name="job_id"/>
<field name="wage"/>
<field name="wage_type_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="name" />
<field name="employee_id" />
<field name="job_id"/>
<field name="wage"/>
<field name="wage_type_id" widget="selection"/>
<field name="type_id" widget="selection"/>
</group>
<notebook>
<page string="Main Data">
<group col="2" colspan="2">
<separator colspan="2" string="Duration"/>
<field name="date_start" select="1"/>
<field name="date_end" select="1"/>
<field name="working_hours"/>
<separator colspan="2" string="Duration"/>
<field name="date_start" />
<field name="date_end" />
<field name="working_hours"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Advantages"/>
<field name="advantages_net"/>
<field name="advantages_gross"/>
<field name="advantages" nolabel="1" colspan="2"/>
<separator colspan="2" string="Advantages"/>
<field name="advantages_net"/>
<field name="advantages_gross"/>
<field name="advantages" nolabel="1" colspan="2"/>
</group>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="notes" nolabel="1"/>
@ -241,7 +237,7 @@
<field name="arch" type="xml">
<search string="Search Contract Type">
<group col='15' colspan='4'>
<field name="name"/>
<field name="name"/>
</group>
</search>
</field>
@ -254,13 +250,12 @@
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="hr_contract_type_view_search"/>
</record>
<menuitem action="action_hr_contract_type" id="hr_menu_contract_type" parent="next_id_56"/>
<menuitem action="action_hr_contract_type" id="hr_menu_contract_type" parent="next_id_56"/>
<menuitem action="action_hr_contract" id="hr_menu_contract" parent="hr.menu_hr_main" name="Contracts" sequence="4"/>
<!-- Contracts Button on Employee Form -->
<act_window domain="[('employee_id', '=', active_id)]" id="act_hr_employee_2_hr_contract" name="Contracts" res_model="hr.contract" src_model="hr.employee"/>
</data>
</openerp>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<data noupdate="1">
<record id="group_hr_contract" model="res.groups">
<field name="name">Human Resources / Contracts</field>
</record>
<record id="group_hr_contract" model="res.groups">
<field name="name">Human Resources / Contracts</field>
</record>
</data>
</data>
</openerp>

View File

@ -21,27 +21,29 @@
{
"name" : "Human Resources Evaluation",
"version" : "0.1",
"author" : "Tiny",
"category" : "Generic Modules/Human Resources",
"website" : "http://www.openerp.com",
"depends" : ["hr",'hr_recruitment','survey'],
"version": "0.1",
"author": "Tiny",
"category": "Generic Modules/Human Resources",
"website": "http://www.openerp.com",
"depends": ["hr",'hr_recruitment','survey'],
"description": """
Ability to create employees evaluation.
An evaluation can be created by employee for subordinates,
juniors as well as his manager.The evaluation is done under a plan
in which various surveys can be created and it can be defined which
level of employee hierarchy fills what and final review and evaluation
is done by the manager.Every evaluation filled by the employees can be viewed
in the form of.Implements a dashboard for My Current Evaluations """,
"init_xml" : [],
"demo_xml" : ["hr_evaluation_demo.xml",
Ability to create employees evaluation.
An evaluation can be created by employee for subordinates,
juniors as well as his manager.The evaluation is done under a plan
in which various surveys can be created and it can be defined which
level of employee hierarchy fills what and final review and evaluation
is done by the manager.Every evaluation filled by the employees can be viewed
in the form of.Implements a dashboard for My Current Evaluations
""",
"init_xml": [],
"demo_xml": ["hr_evaluation_demo.xml",
],
"update_xml" : [
"security/ir.model.access.csv",
"wizard/hr_evaluation_mail_view.xml",
"hr_evaluation_view.xml",
"report/hr_evaluation_report_view.xml"],
"update_xml": [
"security/ir.model.access.csv",
"wizard/hr_evaluation_mail_view.xml",
"hr_evaluation_view.xml",
"report/hr_evaluation_report_view.xml"
],
"test": ["test/test_hr_evaluation.yml"],
"active": False,
"installable": True

View File

@ -36,11 +36,11 @@ class hr_evaluation_plan(osv.osv):
'month_first': fields.integer('First Evaluation After'),
'month_next': fields.integer('Next Evaluation After'),
'active': fields.boolean('Active')
}
}
_defaults = {
'active' : True,
'active': True,
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
}
}
hr_evaluation_plan()
class hr_evaluation_plan_phase(osv.osv):
@ -75,8 +75,8 @@ class hr_evaluation_plan_phase(osv.osv):
'email_subject':fields.text('char')
}
_defaults = {
'sequence' : lambda *a: 1,
'email_subject':_('''Regarding '''),
'sequence' : 1,
'email_subject': _('''Regarding '''),
'mail_body' : lambda *a:_('''
Date : %(date)s
@ -93,8 +93,6 @@ Thanks,
'''),
}
hr_evaluation_plan_phase()
class hr_employee(osv.osv):
@ -106,6 +104,8 @@ class hr_employee(osv.osv):
}
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
if context is None:
context = {}
for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context):
if id.evaluation_plan_id and id.evaluation_date:
if (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
@ -113,7 +113,7 @@ class hr_employee(osv.osv):
self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id}, context)
return True
def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context={}):
def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context=None):
evaluation_date = evaluation_date or False
evaluation_plan_obj=self.pool.get('hr_evaluation.plan')
if evaluation_plan_id:
@ -127,10 +127,10 @@ class hr_employee(osv.osv):
evaluation_date=(dt.ISO.ParseAny(evaluation_date)+ dt.RelativeDateTime(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d')
flag = True
if ids and flag:
self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : ids[0], 'plan_id': evaluation_plan_id}, context=context)
return {'value': {'evaluation_date':evaluation_date}}
self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id': ids[0], 'plan_id': evaluation_plan_id}, context=context)
return {'value': {'evaluation_date': evaluation_date}}
def create(self, cr, uid, vals, context={}):
def create(self, cr, uid, vals, context=None):
id = super(hr_employee, self).create(cr, uid, vals, context=context)
if vals.get('evaluation_plan_id', False):
self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context)
@ -183,7 +183,7 @@ class hr_evaluation(osv.osv):
res.append((record['id'], name))
return res
def onchange_employee_id(self, cr, uid, ids, employee_id, context={}):
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
employee_obj=self.pool.get('hr.employee')
evaluation_plan_id=''
if employee_id:
@ -193,7 +193,7 @@ class hr_evaluation(osv.osv):
employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context)
return {'value': {'plan_id':evaluation_plan_id}}
def button_plan_in_progress(self, cr, uid, ids, context={}):
def button_plan_in_progress(self, cr, uid, ids, context=None):
apprai_id = []
for evaluation in self.browse(cr, uid, ids, context):
wait = False
@ -224,13 +224,8 @@ class hr_evaluation(osv.osv):
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [int_id], context=context)
if (not wait) and phase.mail_feature:
body = phase.mail_body % {
'employee_name': child.name,
'user_signature': user.signature,
'eval_name': phase.survey_id.title,
'date': time.strftime('%Y-%m-%d'),
'time': time
}
body = phase.mail_body % {'employee_name': child.name, 'user_signature': user.signature,
'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time }
sub = phase.email_subject
dest = [child.work_email]
if dest:
@ -239,7 +234,7 @@ class hr_evaluation(osv.osv):
self.write(cr, uid, ids, {'state':'wait'}, context=context)
return True
def button_final_validation(self, cr, uid, ids, context={}):
def button_final_validation(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'progress'})
request_obj = self.pool.get('hr.evaluation.interview')
for id in self.browse(cr, uid ,ids,context=context):
@ -247,21 +242,21 @@ class hr_evaluation(osv.osv):
raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state"))
return True
def button_done(self,cr, uid, ids, context={}):
def button_done(self,cr, uid, ids, context=None):
self.write(cr,uid,ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context)
return True
def button_cancel(self, cr, uid, ids, context={}):
def button_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
return True
hr_evaluation()
class survey_request(osv.osv):
_inherit="survey.request"
_inherit = "survey.request"
_columns = {
'is_evaluation':fields.boolean('Is Evaluation?'),
}
'is_evaluation': fields.boolean('Is Evaluation?'),
}
_defaults = {
'state': 'waiting_answer',
}
@ -269,19 +264,19 @@ class survey_request(osv.osv):
survey_request()
class hr_evaluation_interview(osv.osv):
_name='hr.evaluation.interview'
_inherits={'survey.request':'request_id'}
_description='Evaluation Interview'
_name = 'hr.evaluation.interview'
_inherits = {'survey.request': 'request_id'}
_description = 'Evaluation Interview'
_columns = {
'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade'),
'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
'evaluation_id' : fields.many2one('hr_evaluation.evaluation', 'Evaluation Type'),
}
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation Type'),
}
_defaults = {
'is_evaluation': True,
}
}
def survey_req_waiting_answer(self, cr, uid, ids, context={}):
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state' : 'waiting_answer'})
return True
@ -306,16 +301,16 @@ class hr_evaluation_interview(osv.osv):
tot_done_req += 1
if not flag and wating_id:
self.survey_req_waiting_answer(cr, uid, [wating_id], context)
hr_eval_obj.write(cr, uid, [id.evaluation_id.id], {'progress' :tot_done_req * 100 / len(records)}, context=context)
self.write(cr, uid, ids, { 'state' : 'done'})
hr_eval_obj.write(cr, uid, [id.evaluation_id.id], {'progress': tot_done_req * 100 / len(records)}, context=context)
self.write(cr, uid, ids, { 'state': 'done'})
return True
def survey_req_draft(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, { 'state' : 'draft'}, context=context)
def survey_req_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state': 'draft'}, context=context)
return True
def survey_req_cancel(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, { 'state' : 'cancel'}, context=context)
def survey_req_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, { 'state': 'cancel'}, context=context)
return True
def action_print_survey(self, cr, uid, ids, context=None):
@ -331,12 +326,12 @@ class hr_evaluation_interview(osv.osv):
"""
if not context:
context = {}
record = self.browse(cr, uid, ids, context)
record = record and record[0]
context.update({'survey_id': record.survey_id.id, 'response_id' : [record.response.id], 'response_no':0,})
context.update({'survey_id': record.survey_id.id, 'response_id': [record.response.id], 'response_no':0,})
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context)
return value
hr_evaluation_interview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="survey_2" model="survey">
<field name="title">Employee Evaluation</field>
<field name="max_response_limit">20</field>
@ -10,6 +11,7 @@
<field name="response_user">5</field>
</record>
</data>
<data>
<record id="survey_3" model="survey">
<field name="title">Employee Opinion</field>
@ -20,6 +22,7 @@
<field name="response_user">5</field>
</record>
</data>
<data>
<record id="survey_page_1" model="survey.page">
<field name="title">Employee Evaluation Form</field>
@ -27,6 +30,7 @@
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_page_2" model="survey.page">
<field name="title">Process</field>
@ -42,6 +46,7 @@
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_page_6" model="survey.page">
<field name="title">Employee Performance In Key Areas</field>
@ -81,8 +86,6 @@
</record>
</data>
<data>
<record id="survey_question_0" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -132,6 +135,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_3" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -156,6 +160,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_4" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -203,6 +208,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<!--record id="survey_question_7" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -227,6 +233,7 @@
<field eval="0" name="allow_comment"/>
</record-->
</data>
<data>
<record id="survey_question_8" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -304,8 +311,6 @@
</record>
</data>
<data>
<record id="survey_question_14" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -331,7 +336,6 @@
</record>
</data>
<data>
<record id="survey_question_17" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -356,6 +360,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_18" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -381,8 +386,6 @@
</record>
</data>
<data>
<record id="survey_question_23" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -436,6 +439,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_40" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -460,6 +464,7 @@
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_41" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -502,7 +507,6 @@
<field name="type">descriptive_text</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</field>
<field name="descriptive_text">* It is the joint responsibility of the employee and the supervisor (appraiser) to establish a feasible work plan for the coming year, including major employee responsibilities and corresponding benchmarks against which results will be evaluated.
* Critical or key elements of performance and professional development needs (if any), should also be noted at this time</field>
<field eval="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/>
@ -583,7 +587,6 @@ Once the form had been filled, the employee send it to his supervisor.
</record>
</data>
<!--data>
<record id="survey_question_42" model="survey.question">
<field name="in_visible_answer_type">1</field>
@ -727,6 +730,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="0" name="allow_comment"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_4" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -735,6 +739,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_4"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_5" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -743,6 +748,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_4"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_6" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -751,6 +757,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_4"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_7" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -759,6 +766,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_4"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_8" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -767,6 +775,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_4"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_9" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -775,6 +784,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_8"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_10" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -783,6 +793,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_8"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_11" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -791,6 +802,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_8"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_12" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -799,6 +811,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_8"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_13" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -807,6 +820,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_8"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_14" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -815,6 +829,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_3"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_15" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -823,6 +838,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_3"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_16" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -831,6 +847,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_3"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_17" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -839,6 +856,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_3"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_18" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -847,6 +865,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_3"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_19" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -855,6 +874,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_6"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_20" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -863,6 +883,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_6"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_21" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -871,6 +892,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_6"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_22" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -879,6 +901,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_6"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_23" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -887,6 +910,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_6"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_24" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -895,6 +919,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_10"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_25" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -903,6 +928,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_10"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_26" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -911,6 +937,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_10"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_27" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -919,6 +946,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_10"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_28" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -927,6 +955,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_10"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_29" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -935,6 +964,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_14"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_30" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -943,6 +973,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_14"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_31" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -951,6 +982,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_14"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_32" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -959,6 +991,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_14"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_33" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -967,6 +1000,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_14"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_34" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -975,6 +1009,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_18"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_35" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -983,6 +1018,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_18"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_36" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -991,6 +1027,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_18"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_37" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -999,6 +1036,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_18"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_38" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1007,6 +1045,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_18"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_39" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1015,6 +1054,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_40"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_40" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1023,6 +1063,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_40"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_41" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1031,6 +1072,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_40"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_42" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1039,6 +1081,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_40"/>
</record>
</data>
<data>
<record id="survey_question_column_heading_43" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1056,6 +1099,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_1" model="survey.answer">
<field name="answer">Name</field>
@ -1064,6 +1108,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_2" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1072,6 +1117,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_3" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1080,6 +1126,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_4" model="survey.answer">
<field name="in_visible_answer_type">0</field>
@ -1089,6 +1136,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_5" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1097,6 +1145,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_6" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1105,6 +1154,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_7" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1113,6 +1163,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="1" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_8" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1121,6 +1172,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_9" model="survey.answer">
<field name="in_visible_answer_type">0</field>
@ -1130,6 +1182,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_10" model="survey.answer">
<field name="answer">Position Title</field>
@ -1138,6 +1191,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_11" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1146,6 +1200,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_12" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1154,6 +1209,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_13" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1162,6 +1218,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_14" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1170,6 +1227,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_15" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1178,6 +1236,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="2" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_16" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1187,6 +1246,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_17" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1195,6 +1255,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_18" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1203,6 +1264,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_19" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1211,6 +1273,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_20" model="survey.answer">
<field name="answer">Appraisal for Period</field>
@ -1219,6 +1282,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_21" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1227,6 +1291,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="3" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_22" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1235,6 +1300,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="4" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_23" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1243,6 +1309,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="4" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_24" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1251,6 +1318,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="4" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_25" model="survey.answer">
<field name="answer">Date of Review</field>
@ -1259,6 +1327,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="4" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_26" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1267,6 +1336,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_27" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1276,8 +1346,6 @@ Once the form had been filled, the employee send it to his supervisor.
</record>
</data>
<data>
<record id="survey_answer_31" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1287,7 +1355,6 @@ Once the form had been filled, the employee send it to his supervisor.
</record>
</data>
<data>
<record id="survey_answer_43" model="survey.answer">
<field name="answer">Appraiser</field>
@ -1296,6 +1363,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_44" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1304,6 +1372,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_45" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1312,6 +1381,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_46" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1320,6 +1390,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_47" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1328,6 +1399,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_48" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1336,6 +1408,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_49" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1344,6 +1417,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_50" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1352,6 +1426,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_51" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1360,6 +1435,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_52" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1377,6 +1453,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_68" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1385,6 +1462,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_69" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1393,6 +1471,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_70" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1401,6 +1480,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_71" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1409,6 +1489,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_72" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1417,6 +1498,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_73" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1425,6 +1507,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_74" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1433,6 +1516,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_75" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1441,6 +1525,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_76" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1449,6 +1534,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_77" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1457,6 +1543,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="5" name="sequence"/>
</record>
</data>
<data>
<record id="survey_answer_78" model="survey.answer">
<field name="in_visible_answer_type">1</field>
@ -1483,6 +1570,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_9"/>
</record>
</data>
<data>
<record id="survey_tbl_column_heading_results0" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1491,6 +1579,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="question_id" ref="survey_question_9"/>
</record>
</data>
<data>
<record id="survey_tbl_column_heading_comments0" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field>
@ -1500,7 +1589,6 @@ Once the form had been filled, the employee send it to his supervisor.
</record>
</data>
<!-- <data noupdate="1">-->
<!-- <record id="survey_request_1" model="survey.request">-->
<!-- <field name="state">waiting_answer</field>-->
@ -1510,6 +1598,7 @@ Once the form had been filled, the employee send it to his supervisor.
<!-- <field name="date_deadline">2010-02-21</field>-->
<!-- </record>-->
<!-- </data>-->
<data noupdate="1">
<record id="hr_evaluation_plan_managersevaluationplan0" model="hr_evaluation.plan">
<field eval="1" name="active"/>
@ -1519,6 +1608,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field name="company_id" ref="base.main_company"/>
</record>
</data>
<data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtosubordinates0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/>
@ -1534,6 +1624,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="0" name="wait"/>
</record>
</data>
<data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtomanagers0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/>
@ -1549,6 +1640,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="0" name="wait"/>
</record>
</data>
<data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtoemployee0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/>
@ -1564,6 +1656,7 @@ Once the form had been filled, the employee send it to his supervisor.
<field eval="0" name="wait"/>
</record>
</data>
<data noupdate="1">
<record id="hr_evaluation_plan_phase_finalinterviewwithmanager0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/>
@ -1603,8 +1696,7 @@ Once the form had been filled, the employee send it to his supervisor.
<!-- </data>-->
<data>
<record forcecreate="True" id="ir_cron_scheduler_evaluation"
model="ir.cron">
<record forcecreate="True" id="ir_cron_scheduler_evaluation" model="ir.cron">
<field name="name">Run Employee Evaluation</field>
<field eval="True" name="active" />
<field name="user_id" ref="base.user_root" />

View File

@ -61,13 +61,10 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Evaluations" parent="hr.menu_hr_root" id="menu_eval_hr" sequence="6"/>
<menuitem
name="Periodic Evaluations" parent="hr.menu_hr_configuration" id="menu_eval_hr_config" sequence="4"/>
<menuitem
parent="menu_eval_hr_config"
id="menu_open_view_hr_evaluation_plan_tree"
<menuitem name="Evaluations" parent="hr.menu_hr_root" id="menu_eval_hr" sequence="6"/>
<menuitem name="Periodic Evaluations" parent="hr.menu_hr_configuration" id="menu_eval_hr_config" sequence="4"/>
<menuitem parent="menu_eval_hr_config" id="menu_open_view_hr_evaluation_plan_tree"
action="open_view_hr_evaluation_plan_tree"/>
<record model="ir.ui.view" id="view_hr_evaluation_plan_phase_form">
@ -185,30 +182,19 @@
<newline/>
<group col="6" colspan="4">
<field name="state"/>
<button name="button_plan_in_progress"
string="Start Evaluation"
states="draft"
type="object"
<button name="button_plan_in_progress" string="Start Evaluation" states="draft" type="object"
icon="gtk-execute"/>
<button name="button_final_validation"
string="Final Validation"
states="wait"
type="object"
<button name="button_final_validation" string="Final Validation" states="wait" type="object"
icon="gtk-execute"/>
<button name="button_done"
string="Done"
states="progress"
type="object"
<button name="button_done" string="Done" states="progress" type="object"
icon="gtk-jump-to"/>
<button name="button_cancel"
string="Cancel"
states="draft,wait,progress"
type="object"
<button name="button_cancel" string="Cancel" states="draft,wait,progress" type="object"
icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_hr_evaluation_tree">
<field name="name">hr_evaluation.evaluation.tree</field>
<field name="model">hr_evaluation.evaluation</field>
@ -225,6 +211,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_hr_evaluation_graph">
<field name="name">hr_evaluation.evaluation.graph</field>
<field name="model">hr_evaluation.evaluation</field>
@ -236,6 +223,7 @@
</graph>
</field>
</record>
<record id="hr_evaluation.evaluation_search" model="ir.ui.view">
<field name="name">hr_evaluation.evaluation_search</field>
<field name="model">hr_evaluation.evaluation</field>
@ -243,22 +231,17 @@
<field name="arch" type="xml">
<search string="Search Evaluation">
<group col='10' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="In progress" domain="[('state','=','wait')]"/>
<filter icon="terp-dialog-close" string="Final Step" domain="[('state','=','progress')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-week" string="7 Days"
help="Evaluations to close within the next 7 days"
domain="[('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="In progress" domain="[('state','=','wait')]"/>
<filter icon="terp-dialog-close" string="Final Step" domain="[('state','=','progress')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-week" string="7 Days" help="Evaluations to close within the next 7 days"
domain="[('date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
<filter icon="terp-gnome-cpu-frequency-applet+" string="Overpassed"
help="Evaluations that overpassed the deadline"
domain="[('date','&gt;=',(datetime.date.today()))]"
/>
help="Evaluations that overpassed the deadline" domain="[('date','&gt;=',(datetime.date.today()))]" />
<separator orientation="vertical"/>
<field name="employee_id" select="1"/>
<field name="plan_id" widget="selection" select="1"/>
<field name="employee_id" />
<field name="plan_id" widget="selection" />
</group>
<newline/>
<group expand='0' string='Group by...'>
@ -278,9 +261,8 @@
<field name="view_mode">tree,form,graph</field>
<field name="search_view_id" ref="hr_evaluation.evaluation_search"/>
</record>
<menuitem
name="Evaluation" parent="menu_eval_hr"
id="menu_open_view_hr_evaluation_tree"
<menuitem name="Evaluation" parent="menu_eval_hr" id="menu_open_view_hr_evaluation_tree"
action="open_view_hr_evaluation_tree"/>
<record model="ir.ui.view" id="view_hr_evaluation_interview_form">
@ -293,10 +275,8 @@
<field name="survey_id"/>
<field name="evaluation_id"/>
<group col="2" colspan="2">
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done"
icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done" icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
</group>
<field name="date_deadline"/>
<field name="response" readonly="1"/>
@ -327,10 +307,8 @@
<field name="user_id" string="Interviewer"/>
<field name="user_to_review_id"/>
<field name="response" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done"
icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0}" attrs="{'readonly':[('response','=',False)]}" />
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done" icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0}" attrs="{'readonly':[('response','=',False)]}" />
<field name="state"/>
</tree>
</field>
@ -369,17 +347,13 @@
<field name="search_view_id" ref="view_hr_evaluation_interview_search"/>
</record>
<menuitem
name="Interview Requests" parent="menu_eval_hr"
id="menu_open_hr_evaluation_interview_requests"
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
<menuitem name="Evaluation Reminders" parent="menu_eval_hr"
id="menu_eval_send_mail"
action="action_hr_evaluation_send_mail"
sequence="45"/>
<menuitem name="Evaluation Reminders" parent="menu_eval_hr" id="menu_eval_send_mail"
action="action_hr_evaluation_send_mail" sequence="45"/>
<!-- Evaluation Interviews Button on Employee Form -->
<act_window domain="[('user_to_review_id', '=', active_id)]" id="act_hr_employee_2_hr__evaluation_interview" name="Evaluation Interviews" res_model="hr.evaluation.interview" src_model="hr.employee"/>
</data>
</openerp>

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hr_evaluation_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import tools
from osv import fields,osv
@ -75,9 +76,9 @@ class hr_evaluation_report(osv.osv):
s.state
from
hr_evaluation_interview l
left join
LEFT JOIN
hr_evaluation_evaluation s on (s.id=l.evaluation_id)
group by
GROUP BY
s.create_date,
date_trunc('day',s.create_date),
to_char(s.create_date, 'YYYY-MM-DD'),
@ -92,5 +93,8 @@ class hr_evaluation_report(osv.osv):
s.plan_id
)
""")
hr_evaluation_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<record id="view_evaluation_report_tree" model="ir.ui.view">
<field name="name">hr.evaluation.report.tree</field>
<field name="model">hr.evaluation.report</field>
@ -43,33 +44,18 @@
<search string="Evaluations Analysis">
<group>
<filter icon="terp-go-year" string="365 Days"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 365 days"/>
<filter icon="terp-go-month" string="30 Days"
name="month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Tasks during last 7 days"/>
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date', '&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]" help="Tasks performed in last 365 days"/>
<filter icon="terp-go-month" string="30 Days" name="month" domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" help="Tasks performed in last 30 days"/>
<filter icon="terp-go-week" string=" 7 Days " separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Tasks during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-document-new"
domain="[('state','=','draft')]"
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]"
help = "Draft Evaluations"/>
<filter string="Plan In Progress"
icon="terp-camera_test"
domain="[('state', '=' ,'wait')]"
<filter string="Plan In Progress" icon="terp-camera_test" domain="[('state', '=' ,'wait')]"
help = "In progress Evaluations"/>
<filter string="Final Validation"
icon="terp-check"
domain="[('state','=','progress')]"
<filter string="Final Validation" icon="terp-check" domain="[('state','=','progress')]"
help = "Final Validation Evaluations"/>
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="employee_id" widget="selection"/>
<field name="plan_id" widget="selection"/>
@ -86,13 +72,13 @@
<filter string="Month" icon="terp-go-month" context="{'group_by':'create_date'}"/>
<filter string="Year" icon="terp-go-month" context="{'group_by':'year'}"/>
</group>
<newline/>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<field name="rating"/>
<separator orientation="vertical"/>
<field name="deadline"/>
<separator orientation="vertical"/>
<field name="state"/>
<field name="rating"/>
<separator orientation="vertical"/>
<field name="deadline"/>
<separator orientation="vertical"/>
<field name="state"/>
</group>
</search>
</field>
@ -110,5 +96,5 @@
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="10"/>
<menuitem action="action_evaluation_report_all" id="menu_evaluation_report_all" parent="hr.menu_hr_reporting" sequence="3"/>
</data>
</data>
</openerp>

View File

@ -21,5 +21,4 @@
import hr_evaluation_mail
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,7 +28,7 @@ class hr_evaluation_reminder(osv.osv_memory):
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluations', required=True)
}
def send_mail(self, cr, uid, ids, context={}):
def send_mail(self, cr, uid, ids, context=None):
hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation')
evaluation_data = self.read(cr, uid, ids, context=context)[0]
for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids:
@ -40,4 +40,4 @@ class hr_evaluation_reminder(osv.osv_memory):
hr_evaluation_reminder()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_evaluation_send_mail" model="ir.ui.view">
<field name="name">hr.evaluation.send.mail</field>
<field name="model">hr.evaluation.reminder</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Evaluation Reminders">
<group width="340">
<separator string="Send evaluation reminder" colspan="4"/>
<field name="evaluation_id"/>
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="send_mail" string="Send Mail" type="object" icon="gtk-ok"/>
</group>
<record id="view_hr_evaluation_send_mail" model="ir.ui.view">
<field name="name">hr.evaluation.send.mail</field>
<field name="model">hr.evaluation.reminder</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Evaluation Reminders">
<group width="340">
<separator string="Send evaluation reminder" colspan="4"/>
<field name="evaluation_id"/>
<separator colspan="4"/>
<group colspan="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="send_mail" string="Send Mail" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
</group>
</form>
</field>
</record>
<record id="action_hr_evaluation_send_mail" model="ir.actions.act_window">
<field name="name">Evaluation Send Mail</field>
<field name="res_model">hr.evaluation.reminder</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_hr_evaluation_send_mail"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<field name="name">Evaluation Send Mail</field>
<field name="res_model">hr.evaluation.reminder</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_hr_evaluation_send_mail"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -51,10 +51,11 @@
'process/hr_expense_process.xml',
'report/hr_expense_report_view.xml',
'board_hr_expense_view.xml',
],
'demo_xml': ['hr_expense_demo.xml',
# 'hr.expense.expense.csv'
],
],
'demo_xml': [
'hr_expense_demo.xml',
# 'hr.expense.expense.csv'
],
'test': ['test/test_hr_expense.yml'],
'installable': True,
'active': False,

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="action_my_expense" model="ir.actions.act_window">
<field name="name">My Expenses</field>
<field name="res_model">hr.expense.expense</field>
@ -20,5 +21,6 @@
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -25,7 +25,7 @@ from osv import fields, osv
from tools.translate import _
def _employee_get(obj, cr, uid, context=None):
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)])
if ids:
return ids[0]
return False
@ -34,15 +34,15 @@ class hr_expense_expense(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default: default = {}
default.update( {'invoice_id':False,'date_confirm':False,'date_valid':False,'user_valid':False})
default.update({'invoice_id': False, 'date_confirm': False, 'date_valid': False, 'user_valid': False})
return super(hr_expense_expense, self).copy(cr, uid, id, default, context)
def _amount(self, cr, uid, ids, field_name, arg, context):
cr.execute("SELECT s.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_expense s LEFT OUTER JOIN hr_expense_line l ON (s.id=l.expense_id) WHERE s.id IN %s GROUP BY s.id ",(tuple(ids),))
def _amount(self, cr, uid, ids, field_name, arg, context=None):
cr.execute("SELECT s.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_expense s LEFT OUTER JOIN hr_expense_line l ON (s.id=l.expense_id) WHERE s.id IN %s GROUP BY s.id ", (tuple(ids),))
res = dict(cr.fetchall())
return res
def _get_currency(self, cr, uid, context):
def _get_currency(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, [uid])[0]
if user.company_id:
return user.company_id.currency_id.id
@ -158,18 +158,17 @@ class hr_expense_expense(osv.osv):
'fiscal_position': exp.employee_id.address_id.partner_id.property_account_position.id
}
if payment_term_id:
to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [],
payment_term_id, None)
to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], payment_term_id, None)
if to_update:
inv.update(to_update['value'])
if exp.journal_id:
inv['journal_id']=exp.journal_id.id
inv_id = invoice_obj.create(cr, uid, inv, {'type':'in_invoice'})
invoice_obj.button_compute(cr, uid, [inv_id], {'type':'in_invoice'},
set_total=True)
inv_id = invoice_obj.create(cr, uid, inv, {'type': 'in_invoice'})
invoice_obj.button_compute(cr, uid, [inv_id], {'type': 'in_invoice'}, set_total=True)
self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'})
res = inv_id
return res
hr_expense_expense()
class product_product(osv.osv):
@ -184,7 +183,7 @@ class hr_expense_line(osv.osv):
_name = "hr.expense.line"
_description = "Expense Line"
def _amount(self, cr, uid, ids, field_name, arg, context):
def _amount(self, cr, uid, ids, field_name, arg, context=None):
if not len(ids):
return {}
cr.execute("SELECT l.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_line l WHERE id IN %s GROUP BY l.id ",(tuple(ids),))
@ -204,11 +203,11 @@ class hr_expense_line(osv.osv):
'analytic_account': fields.many2one('account.analytic.account','Analytic account'),
'ref': fields.char('Reference', size=32),
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."),
}
}
_defaults = {
'unit_quantity': lambda *a: 1,
'date_value' : lambda *a: time.strftime('%Y-%m-%d'),
}
'unit_quantity': 1,
'date_value': time.strftime('%Y-%m-%d'),
}
_order = "sequence"
def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
@ -218,13 +217,11 @@ class hr_expense_line(osv.osv):
if product_id:
product=self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v['name']=product.name
# Compute based on pricetype of employee company
pricetype_id = self.pool.get('hr.employee').browse(cr, uid, employee_id).user_id.company_id.property_valuation_price_type.id
context['currency_id']=self.pool.get('hr.employee').browse(cr, uid, employee_id).user_id.company_id.currency_id.id
pricetype=self.pool.get('product.price.type').browse(cr, uid, pricetype_id)
amount_unit=product.price_get(pricetype.field, context)[product.id]
v['unit_amount']=amount_unit
if not uom_id:
v['uom_id']=product.uom_id.id

View File

@ -58,6 +58,7 @@
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="1.0" name="unit_quantity"/>
</record>
<record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line">
<field name="name">Basic PC - Server for Seagate</field>
<field name="date_value">2010-05-03</field>
@ -68,7 +69,9 @@
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="1.0" name="unit_quantity"/>
</record>
</data>
<data noupdate="1">
<record id="hr_expense_expense_septemberexpenses1" model="hr.expense.expense">
<field name="currency_id" ref="base.EUR"/>
@ -79,6 +82,7 @@
<field name="date">2010-04-20</field>
<field name="state">draft</field>
</record>
<record id="hr_expense_line_hotelexpensesthymbra0" model="hr.expense.line">
<field name="name">Hotel Expenses - Thymbra</field>
<field name="date_value">2010-05-03</field>
@ -89,17 +93,17 @@
<field name="uom_id" ref="product.product_uom_unit"/>
<field eval="5.0" name="unit_quantity"/>
</record>
<record id="hr_expense_line_car_travel" model="hr.expense.line">
<field name="name">Bruxelles - Paris</field>
<field name="date_value">2010-05-03</field>
<field name="analytic_account" ref="account.analytic_thymbra"/>
<field name="product_id" ref="product_product_expense_car"/>
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'Travel Expenses')]"/>
<field eval="0.30" name="unit_amount"/>
<field name="uom_id" ref="product.product_uom_km"/>
<field eval="622.0" name="unit_quantity"/>
</record>
<record id="hr_expense_line_car_travel" model="hr.expense.line">
<field name="name">Bruxelles - Paris</field>
<field name="date_value">2010-05-03</field>
<field name="analytic_account" ref="account.analytic_thymbra"/>
<field name="product_id" ref="product_product_expense_car"/>
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'Travel Expenses')]"/>
<field eval="0.30" name="unit_amount"/>
<field name="uom_id" ref="product.product_uom_km"/>
<field eval="622.0" name="unit_quantity"/>
</record>
</data>
</openerp>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False" id="hr_expenses" model="hr.expense.expense" name="hr.expense" rml="hr_expense/report/expense.rml" string="HR expenses"/>
</data>
</openerp>

View File

@ -1,15 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="seq_type_hr_expense_invoice" model="ir.sequence.type">
<field name="name">Expense invoice</field>
<field name="code">hr.expense.invoice</field>
</record>
<record id="seq_hr_expense_invoice" model="ir.sequence">
<field name="name">Expense invoice</field>
<field name="code">hr.expense.invoice</field>
<field name="prefix">EXP/</field>
<field name="padding">3</field>
</record>
</data>
</openerp>

View File

@ -81,8 +81,8 @@
<form string="Expense Lines">
<field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id)"/>
<field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id)" widget="selection"/>
<field name="name" select="1"/>
<field name="date_value" select="1"/>
<field name="name" />
<field name="date_value" />
<field name="unit_quantity"/>
<field name="unit_amount"/>
<field name="ref"/>
@ -126,28 +126,17 @@
<field name="arch" type="xml">
<search string="Expense">
<group>
<filter
icon="terp-document-new"
domain="[('state','=','draft')]"
string="Draft"
help="Draft Expense"/>
<filter icon="terp-document-new" domain="[('state','=','draft')]" string="Draft" help="Draft Expense"/>
<separator orientation="vertical"/>
<filter
icon="terp-gtk-go-back-rtl"
domain="[('state','=','confirm')]"
string="To Validate"
<filter icon="terp-gtk-go-back-rtl" domain="[('state','=','confirm')]" string="To Validate"
help="Confirmed Expense"/>
<filter
icon="terp-gtk-go-back-rtl"
domain="[('state','=','accepted')]"
string="To Pay"
<filter icon="terp-gtk-go-back-rtl" domain="[('state','=','accepted')]" string="To Pay"
help="Expenses to Invoice"/>
<separator orientation="vertical"/>
<field name="name" select='1'/>
<field name="date" select='1'/>
<field name="user_id" select="1" string="User">
<filter icon="terp-personal+"
domain="[('department_id','=',context.get('department_id',False))]"
<field name="user_id" string="User">
<filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]"
string="Expenses of My Department"/>
</field>
<field name="department_id" widget="selection" groups="base.group_extended"/>
@ -171,23 +160,20 @@
<field name="search_view_id" ref="view_hr_expense_filter"/>
</record>
<menuitem id="next_id_49" name="Expenses" sequence="4"
parent="hr.menu_hr_root"/>
<menuitem action="expense_all" id="menu_expense_all" name="Expenses"
parent="next_id_49" groups="hr.group_hr_manager"/>
<menuitem id="next_id_49" name="Expenses" sequence="4" parent="hr.menu_hr_root"/>
<menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49" groups="hr.group_hr_manager"/>
<record id="view_product_hr_expense_form" model="ir.ui.view">
<field name="name">product.product.expense.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name">product.product.expense.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="purchase_ok" position="after">
<field name="hr_expense_ok"/>
</field>
</field>
</record>
</field>
</record>
</data>
</openerp>

View File

@ -27,18 +27,21 @@
<field name="kind">function</field>
<field name="action">write({'state': 'draft'})</field>
</record>
<record id="act_confirm" model="workflow.activity">
<field name="wkf_id" ref="wkf_expenses"/>
<field name="name">confirm</field>
<field name="kind">function</field>
<field name="action">expense_confirm()</field>
</record>
<record id="act_accepted" model="workflow.activity">
<field name="wkf_id" ref="wkf_expenses"/>
<field name="name">accepted</field>
<field name="kind">function</field>
<field name="action">expense_accept()</field>
</record>
<record id="act_paid" model="workflow.activity">
<field name="wkf_id" ref="wkf_expenses"/>
<field name="name">paid</field>
@ -46,6 +49,7 @@
<field name="action">expense_paid()</field>
<field name="flow_stop">True</field>
</record>
<record id="act_refused" model="workflow.activity">
<field name="wkf_id" ref="wkf_expenses"/>
<field name="name">refused</field>
@ -53,6 +57,7 @@
<field name="action">expense_canceled()</field>
<!-- <field name="flow_stop">True</field>-->
</record>
<record id="act_invoice" model="workflow.activity">
<field name="wkf_id" ref="wkf_expenses"/>
<field name="name">invoice</field>
@ -66,24 +71,28 @@
<field name="act_to" ref="act_confirm"/>
<field name="signal">confirm</field>
</record>
<record id="t2" model="workflow.transition">
<field name="act_from" ref="act_confirm"/>
<field name="act_to" ref="act_accepted"/>
<field name="signal">validate</field>
<field name="role_id" ref="HR"/>
</record>
<!--record model="workflow.transition" id="t3">
<field name="act_from" ref="act_accepted" />
<field name="act_to" ref="act_paid" />
<field name="signal">paid</field>
<field name="role_id" ref="HR"/>
</record-->
<record id="t4" model="workflow.transition">
<field name="act_from" ref="act_confirm"/>
<field name="act_to" ref="act_refused"/>
<field name="signal">refuse</field>
<field name="role_id" ref="HR"/>
</record>
<record id="t5" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_refused"/>
@ -96,33 +105,39 @@
<field name="signal">refuse</field>
<field name="role_id" ref="HR"/>
</record>
<record id="t7" model="workflow.transition">
<field name="act_from" ref="act_confirm"/>
<field name="act_to" ref="act_draft"/>
<field name="signal">draft</field>
<field name="role_id" ref="HR"/>
</record>
<record id="t8" model="workflow.transition">
<field name="act_from" ref="act_accepted"/>
<field name="act_to" ref="act_invoice"/>
<field name="signal">invoice</field>
<field name="role_id" ref="HR_INV"/>
</record>
<record id="t9" model="workflow.transition">
<field name="act_from" ref="act_invoice"/>
<field name="act_to" ref="act_paid"/>
<field name="signal">subflow.paid</field>
</record>
<record id="t10" model="workflow.transition">
<field name="act_from" ref="act_invoice"/>
<field name="act_to" ref="act_refused"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="t11" model="workflow.transition">
<field name="act_from" ref="act_refused"/>
<field name="act_to" ref="act_draft"/>
<field name="signal">draft</field>
<field name="role_id" ref="HR"/>
</record>
</data>
</openerp>

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import expense
import hr_expense_report

View File

@ -24,11 +24,10 @@ from report import report_sxw
import datetime
class expense(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(expense, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
})
self.localcontext.update({'time': time, })
report_sxw.report_sxw('report.hr.expense', 'hr.expense.expense', 'addons/hr_expense/report/expense.rml',parser=expense)

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_expense_report_tree" model="ir.ui.view">
<field name="name">hr.expense.report.tree</field>
<field name="model">hr.expense.report</field>
@ -58,27 +59,15 @@
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Expenses during last month"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Expenses during last 7 days"/>
<filter icon="terp-go-week" string=" 7 Days " separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Expenses during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-document-new"
domain="[('state','=','draft')]"
help = "Draft Expenses"/>
<filter string="Waiting"
icon="terp-gtk-media-pause"
domain="[('state', '=' ,'confirm')]"
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help = "Draft Expenses"/>
<filter string="Waiting" icon="terp-gtk-media-pause" domain="[('state', '=' ,'confirm')]"
help = "Confirm Expenses"/>
<filter string="Accepted"
icon="terp-camera_test"
domain="[('state','=','accepted')]"
<filter string="Accepted" icon="terp-camera_test" domain="[('state','=','accepted')]"
help = "Accepted Expenses"/>
<filter string="Cancelled"
icon="terp-dialog-close"
domain="[('state','=','cancelled')]"
<filter string="Cancelled" icon="terp-dialog-close" domain="[('state','=','cancelled')]"
help = "Cancelled Expenses"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
@ -105,20 +94,19 @@
</group>
<newline/>
<group expand="0" string="Extended filters..." groups="base.group_extended">
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="journal_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="department_id"/>
<separator orientation="vertical"/>
<field name="user_id"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="date"/>
<field name="date_confirm"/>
<field name="date_valid"/>
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="journal_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="department_id"/>
<separator orientation="vertical"/>
<field name="user_id"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="date"/>
<field name="date_confirm"/>
<field name="date_valid"/>
</group>
</search>
</field>

View File

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

View File

@ -21,11 +21,11 @@
{
"name" : "Human Resources: Holidays management",
"version" : "1.5",
"author" : "Tiny & Axelor",
"category" : "Generic Modules/Human Resources",
"website" : "http://www.openerp.com",
"name": "Human Resources: Holidays management",
"version": "1.5",
"author": "Tiny & Axelor",
"category": "Generic Modules/Human Resources",
"website": "http://www.openerp.com",
"description": """Human Ressources: Holidays tracking and workflow
This module allows you to manage leaves and leaves requests.
@ -64,7 +64,7 @@
'wizard/hr_holidays_summary_employees_view.xml',
'board_hr_holidays_view.xml',
#'process/hr_holidays_process.xml'
],
],
'demo_xml': ['hr_holidays_demo.xml',],
'test': ['test/test_hr_holiday.yml'],
'installable': True,

View File

@ -8,7 +8,7 @@
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid)]</field>
<field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="hr_holidays.open_allocation_holidays"/>
</record>
@ -21,6 +21,7 @@
<field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="hr_holidays.view_hr_holidays_remaining_leaves_user_graph"/>
</record>
<record id="board_hr_holidays_form" model="ir.ui.view">
<field name="name">board.hr.holidays.form</field>
<field name="model">board.board</field>

View File

@ -8,59 +8,69 @@
<field name="date_to">2008-01-01 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Easter Monday</field>
<field name="date_from">2008-03-24 08:00</field>
<field name="date_to">2008-03-24 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Labour Day</field>
<field name="date_from">2008-05-01 08:00</field>
<field name="date_to">2008-05-01 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Ascension</field>
<field name="date_from">2008-05-02 08:00</field>
<field name="date_to">2008-05-02 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Pentecost Monday</field>
<field name="date_from">2008-05-12 08:00</field>
<field name="date_to">2008-05-12 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">National Day</field>
<field name="date_from">2008-07-21 08:00</field>
<field name="date_to">2008-07-21 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Assumption Day</field>
<field name="date_from">2008-08-15 08:00</field>
<field name="date_to">2008-08-15 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">All Saints</field>
<field name="date_from">2008-11-01 08:00</field>
<field name="date_to">2008-11-01 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Armistice</field>
<field name="date_from">2008-11-11 08:00</field>
<field name="date_to">2008-11-11 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
<record model="hr.holidays">
<field name="name">Christmas</field>
<field name="date_from">2008-12-25 08:00</field>
<field name="date_to">2008-12-25 18:00</field>
<field name="holiday_status" ref="hr.jf" />
</record>
</data>
</openerp>

View File

@ -20,6 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import datetime
@ -69,6 +70,7 @@ class hr_holidays_status(osv.osv):
return_false = False
employee_id = False
res = {}
if context and context.has_key('employee_id'):
if not context['employee_id']:
return_false = True
@ -100,7 +102,7 @@ class hr_holidays_status(osv.osv):
_defaults = {
'color_name': 'red',
'active': True,
}
}
hr_holidays_status()
@ -110,22 +112,22 @@ class hr_holidays(osv.osv):
_order = "type desc, date_from asc"
def _employee_get(obj, cr, uid, context=None):
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)])
if ids:
return ids[0]
return False
_columns = {
'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}),
'name': fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Waiting Validation'), ('refuse', 'Refused'), ('validate1', 'Waiting Second Validation'), ('validate', 'Validated'), ('cancel', 'Cancelled')], 'State', readonly=True, help='When the holiday request is created the state is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the state is \'Waiting Validation\'.\
If the admin accepts it, the state is \'Validated\'. If it is refused, the state is \'Refused\'.'),
'date_from' : fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}),
'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}),
'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True),
'date_to' : fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
'manager_id' : fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes' : fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
'number_of_days': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
'case_id': fields.many2one('crm.meeting', 'Case'),
@ -140,13 +142,13 @@ class hr_holidays(osv.osv):
}
_defaults = {
'employee_id' : _employee_get ,
'state' : 'draft',
'employee_id': _employee_get ,
'state': 'draft',
'type': 'remove',
'allocation_type': 'employee',
'user_id': lambda obj, cr, uid, context: uid,
'holiday_type': 'employee'
}
}
def _create_resource_leave(self, cr, uid, vals, context=None):
'''This method will create entry in resource calendar leave object at the time of holidays validated '''
@ -215,10 +217,10 @@ class hr_holidays(osv.osv):
self.unlink(cr, uid, list_ids)
def _check_date(self, cr, uid, ids):
for rec in self.read(cr, uid, ids, ['number_of_days_temp','date_from','date_to', 'type']):
for rec in self.read(cr, uid, ids, ['number_of_days_temp', 'date_from','date_to', 'type']):
if rec['number_of_days_temp'] < 0:
return False
if rec['type']=='add':
if rec['type'] == 'add':
continue
date_from = time.strptime(rec['date_from'], '%Y-%m-%d %H:%M:%S')
date_to = time.strptime(rec['date_to'], '%Y-%m-%d %H:%M:%S')
@ -249,7 +251,7 @@ class hr_holidays(osv.osv):
def onchange_date_to(self, cr, uid, ids, date_from, date_to):
return self.onchange_date_from(cr, uid, ids, date_to, date_from)
def onchange_sec_id(self, cr, uid, ids, status, context={}):
def onchange_sec_id(self, cr, uid, ids, status, context=None):
warning = {}
if status:
brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status])[0]
@ -263,7 +265,7 @@ class hr_holidays(osv.osv):
def set_to_draft(self, cr, uid, ids, *args):
wf_service = netsvc.LocalService("workflow")
self.write(cr, uid, ids, {
'state':'draft',
'state': 'draft',
'manager_id': False,
'number_of_days': 0,
})
@ -274,7 +276,7 @@ class hr_holidays(osv.osv):
def holidays_validate2(self, cr, uid, ids, *args):
vals = {'state':'validate1'}
self.check_holidays(cr, uid, ids)
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)])
if ids2:
vals['manager_id'] = ids2[0]
else:
@ -287,17 +289,17 @@ class hr_holidays(osv.osv):
data_holiday = self.browse(cr, uid, ids)
self.check_holidays(cr, uid, ids)
vals = {'state':'validate'}
ids2 = obj_emp.search(cr, uid, [('user_id','=', uid)])
ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
if ids2:
if data_holiday[0].state == 'validate1':
vals['manager_id2'] = ids2[0]
else:
vals['manager_id'] = ids2[0]
else:
raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.'))
raise osv.except_osv(_('Warning !'), _('No user related to the selected employee.'))
self.write(cr, uid, ids, vals)
for record in data_holiday:
if record.holiday_type=='employee' and record.type=='remove':
if record.holiday_type == 'employee' and record.type == 'remove':
vals = {
'name': record.name,
'date_from': record.date_from,
@ -308,7 +310,7 @@ class hr_holidays(osv.osv):
'holiday_id': record.id
}
self._create_resource_leave(cr, uid, vals)
elif record.holiday_type=='category' and record.type=='remove':
elif record.holiday_type == 'category' and record.type == 'remove':
emp_ids = obj_emp.search(cr, uid, [('category_id', '=', record.category_id.id)])
for emp in obj_emp.browse(cr, uid, emp_ids):
vals = {
@ -327,13 +329,13 @@ class hr_holidays(osv.osv):
for record in self.browse(cr, uid, ids):
user_id = False
leave_asked = record.number_of_days_temp
if record.holiday_type=='employee' and record.type == 'remove':
if record.holiday_type == 'employee' and record.type == 'remove':
if record.employee_id and not record.holiday_status_id.limit:
leaves_rest = self.pool.get('hr.holidays.status').get_days( cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
if leaves_rest < leave_asked:
raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves.' %(record.employee_id.name)))
nb = -(record.number_of_days_temp)
elif record.holiday_type=='category' and record.type == 'remove':
elif record.holiday_type == 'category' and record.type == 'remove':
if record.category_id and not record.holiday_status_id.limit:
leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
if leaves_rest < leave_asked:
@ -342,20 +344,14 @@ class hr_holidays(osv.osv):
else:
nb = record.number_of_days_temp
if record.holiday_type=='employee' and record.employee_id:
if record.holiday_type == 'employee' and record.employee_id:
user_id = record.employee_id.user_id and record.employee_id.user_id.id or uid
self.write(cr, uid, [record.id], {
'state':'confirm',
'number_of_days': nb,
'user_id': user_id
})
self.write(cr, uid, [record.id], {'state':'confirm', 'number_of_days': nb, 'user_id': user_id })
return True
def holidays_refuse(self, cr, uid, ids, *args):
vals = {
'state':'refuse',
}
vals = {'state': 'refuse'}
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
if ids2:
vals['manager_id'] = ids2[0]
@ -364,22 +360,18 @@ class hr_holidays(osv.osv):
def holidays_cancel(self, cr, uid, ids, *args):
self._update_user_holidays(cr, uid, ids)
self.write(cr, uid, ids, {
'state':'cancel'
})
self.write(cr, uid, ids, {'state': 'cancel'})
self._remove_resouce_leave(cr, uid, ids)
return True
def holidays_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
'state':'draft'
})
self.write(cr, uid, ids, {'state': 'draft'})
return True
def check_holidays(self, cr, uid, ids):
for record in self.browse(cr, uid, ids):
if not record.number_of_days:
raise osv.except_osv(_('Warning!'),_('Wrong leave definition.'))
raise osv.except_osv(_('Warning!'), _('Wrong leave definition.'))
if record.holiday_type=='employee' and record.employee_id:
leave_asked = record.number_of_days
if leave_asked < 0.00:
@ -387,7 +379,7 @@ class hr_holidays(osv.osv):
leaves_rest = self.pool.get('hr.holidays.status').get_days(cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
if leaves_rest < -(leave_asked):
raise osv.except_osv(_('Warning!'),_('You Cannot Validate leaves while available leaves are less than asked leaves.'))
elif record.holiday_type=='category' and record.category_id:
elif record.holiday_type == 'category' and record.category_id:
leave_asked = record.number_of_days
if leave_asked < 0.00:
if not record.holiday_status_id.limit:
@ -415,7 +407,7 @@ class hr_holidays(osv.osv):
user_id = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
if user_id:
vals['user_id'] = user_id[0]
holiday_ids.append(self.create(cr, uid, vals, context={}))
holiday_ids.append(self.create(cr, uid, vals, context=None))
self.holidays_confirm(cr, uid, holiday_ids)
self.holidays_validate(cr, uid, holiday_ids)
@ -444,7 +436,7 @@ class hr_holidays(osv.osv):
'date' : record.date_from,
}
case_id = self.pool.get('crm.meeting').create(cr, uid, vals)
self.write(cr, uid, ids, {'case_id':case_id})
self.write(cr, uid, ids, {'case_id': case_id})
return True
@ -455,8 +447,8 @@ class resource_calendar_leaves(osv.osv):
_description = "Leave Detail"
_columns = {
'holiday_id': fields.many2one("hr.holidays", "Holiday"),
}
}
resource_calendar_leaves()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_holidays_summary"
string="Summary Of Leaves"
model="hr.holidays"

View File

@ -1,6 +1,7 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="view_hr_holidays_filter" model="ir.ui.view">
<field name="name">hr.holidays.filter</field>
<field name="model">hr.holidays</field>
@ -16,8 +17,7 @@
<field name="user_id"/>
<field name="department_id" widget="selection">
<filter icon="terp-personal+" help="My Department Holidays"
domain="[('department_id.manager_id','=',uid)]"
/>
domain="[('department_id.manager_id','=',uid)]" />
</field>
<field name="holiday_status_id" widget="selection"/>
</group>
@ -44,21 +44,21 @@
<field name="arch" type="xml">
<form string="Leave Request">
<group col="8" colspan="4">
<field name="name" select="1"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130"/>
<field name="name" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130"/>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
<field name="holiday_status_id" select="1" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="department_id"/>
<field name="date_from" select="1" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)" required="1"/>
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" on_change="onchange_date_to(date_from, date_to)" required="1"/>
<field name="number_of_days_temp"/>
<newline/>
<field name="manager_id"/>
@ -66,7 +66,7 @@
<separator string="Notes" colspan="4"/>
<field name="notes" nolabel="1" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<field name="state" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Validate" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
@ -89,15 +89,15 @@
<field name="arch" type="xml">
<form string="Allocation Request">
<group col="4" colspan="4">
<field name="name" select="1"/>
<field name="holiday_status_id" select="1"/>
<field name="name" />
<field name="holiday_status_id" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type"/>
<group col="2" colspan="2">
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" select="1" attrs="{'required':[('holiday_type','=','employee')]}"/>
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" select="1" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
</group>
</group>
@ -110,7 +110,7 @@
<separator string="Notes" colspan="4"/>
<field name="notes" nolabel="1" colspan="4" />
<newline/>
<field name="state" select="1" colspan="2"/>
<field name="state" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Validate" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
@ -130,8 +130,7 @@
<field name="model">hr.holidays</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Leaves"
colors="red:state == 'refuse';grey:state == 'cancel'">
<tree string="Leaves" colors="red:state == 'refuse';grey:state == 'cancel'">
<field name="employee_id"/>
<field name="department_id"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
@ -151,22 +150,22 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Leaves Management">
<field name="name" select="1"/>
<field name="holiday_status_id" select="1"/>
<field name="name" />
<field name="holiday_status_id" />
<!-- <field name="holiday_type"/>
<field name="category_id" select="1" required="1"/>
--> <field name="employee_id" select="1" />
<field name="category_id" required="1"/>
--> <field name="employee_id" />
<!--<field name="department_id"/>-->
<field name="type"/>
<field name="date_from" select="1" on_change="onchange_date_from(date_to, date_from)" attrs="{'readonly':[('type','=','add')], 'required':[('type','=','remove')]}"/>
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)" attrs="{'readonly':[('type','=','add')], 'required':[('type','=','remove')]}"/>
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" attrs="{'readonly':[('type','=','add')], 'required':[('type','=','remove')]}"/>
<field name="date_to" on_change="onchange_date_to(date_from, date_to)" attrs="{'readonly':[('type','=','add')], 'required':[('type','=','remove')]}"/>
<field name="number_of_days_temp"/>
<notebook colspan="4">
<page string="General">
<field name="manager_id"/>
<field name="notes" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<field name="state" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Validate" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
@ -207,8 +206,7 @@
<field name="model">hr.holidays</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Leaves"
colors="red:state == 'refuse';grey:state == 'cancel'">
<tree string="Leaves" colors="red:state == 'refuse';grey:state == 'cancel'">
<field name="employee_id"/>
<field name="department_id"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
@ -271,10 +269,7 @@
<field name="act_window_id" ref="open_ask_holidays"/>
</record>
<menuitem
name="Leave Requests"
parent="menu_open_ask_holidays"
id="menu_open_ask_holidays_new"
<menuitem name="Leave Requests" parent="menu_open_ask_holidays" id="menu_open_ask_holidays_new"
action="open_ask_holidays"/>
<record model="ir.actions.act_window" id="open_allocation_holidays">
@ -301,10 +296,7 @@
<field name="act_window_id" ref="open_allocation_holidays"/>
</record>
<menuitem
name="Allocation Requests"
parent="menu_open_ask_holidays"
id="menu_open_allocation_holidays"
<menuitem name="Allocation Requests" parent="menu_open_ask_holidays" id="menu_open_allocation_holidays"
action="open_allocation_holidays"/>
<record model="ir.actions.act_window" id="open_company_allocation">
@ -331,15 +323,16 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Leave Type">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="name" />
<field name="limit"/>
<field name="active"/>
<field name="categ_id" select="1" widget="selection"/>
<field name="categ_id" widget="selection"/>
<field name="color_name"/>
<field name="double_validation" />
</form>
</field>
</record>
<record model="ir.ui.view" id="view_holiday_status_tree">
<field name="name">hr.holidays.status.tree</field>
<field name="model">hr.holidays.status</field>
@ -352,6 +345,7 @@
</tree>
</field>
</record>
<record id="open_view_holiday_status" model="ir.actions.act_window">
<field name="name">Leave Type</field>
<field name="type">ir.actions.act_window</field>

View File

@ -6,6 +6,7 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="10" />
<menuitem
id="menu_hr_reporting_holidays"
name="Holidays"

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
import tools
@ -32,19 +33,19 @@ class available_holidays_report(osv.osv):
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'employee_id': fields.many2one ('hr.employee', "Employee's Name", readonly=True),
'category_id' : fields.many2one('hr.employee.category', "Category's Name", readonly=True),
'category_id': fields.many2one('hr.employee.category', "Category's Name", readonly=True),
'holiday_status_id': fields.many2one('hr.holidays.status', 'Leave Type', readonly=True),
'max_leave': fields.float('Allocated Leaves', readonly=True),
'taken_leaves': fields.float('Taken Leaves', readonly=True),
'remaining_leave': fields.float('Remaining Leaves',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'remaining_leave': fields.float('Remaining Leaves', readonly=True),
'department_id': fields.many2one('hr.department', 'Department', readonly=True),
'user_id': fields.many2one('res.users', 'User', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'available_holidays_report')
cr.execute("""
create or replace view available_holidays_report as (
select
CREATE or REPLACE view available_holidays_report as (
SELECT
min(h.id) as id,
date_trunc('day',h.create_date) as date,
to_char(s.create_date, 'YYYY') as year,
@ -67,15 +68,16 @@ class available_holidays_report(osv.osv):
and employee_id=h.employee_id
and holiday_status_id=h.holiday_status_id
and state='validate') as max_leave
from hr_holidays h
left join hr_holidays_status s on (s.id = h.holiday_status_id)
where h.state='validate'
FROM hr_holidays h
LEFT JOIN hr_holidays_status s on (s.id = h.holiday_status_id)
WHERE h.state='validate'
and s.active <> 'f'
group by h.holiday_status_id, h.employee_id,
GROUP BY h.holiday_status_id, h.employee_id,
date_trunc('day',h.create_date),to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'), to_char(s.create_date, 'YYYY-MM-DD'), h.user_id,h.state, h.category_id, h.department_id
)""")
available_holidays_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -48,38 +48,28 @@
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-personal" string="Employee"
domain="[('category_id', '=', False)]"
<filter icon="terp-personal" string="Employee" domain="[('category_id', '=', False)]"
help="Leaves by empolyee"/>
<filter icon="terp-stock_symbol-selection" string="Category"
domain="[('employee_id', '=', False)]"
help="Leaves by category"/>
domain="[('employee_id', '=', False)]" help="Leaves by category"/>
<separator orientation="vertical"/>
<filter icon="terp-go-year" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
<filter icon="terp-go-month" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this month"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Leaves during last 7 days"/>
<filter icon="terp-go-month" string="This Month" name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" help="Leaves in this month"/>
<filter icon="terp-go-week" string=" 7 Days " separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Leaves during last 7 days"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal"
string="My Leaves"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-personal" string="My Leaves" domain="[('user_id','=',uid)]"/>
</field>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="holiday_status_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<field name="holiday_status_id" widget="selection"/>
<field name="department_id" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="10" col="12">
@ -96,8 +86,6 @@
</field>
</record>
<record id="action_hr_available_holidays_report" model="ir.actions.act_window">
<field name="name">Available Holidays</field>
<field name="res_model">available.holidays.report</field>
@ -112,20 +100,17 @@
<field name="view_mode">tree</field>
<field name="view_id" ref="view_hr_available_holidays_report_tree"/>
<field name="act_window_id" ref="action_hr_available_holidays_report"/>
</record>
</record>
<record model="ir.actions.act_window.view" id="action_hr_available_holidays_report_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_hr_available_holidays_report_graph"/>
<field name="act_window_id" ref="action_hr_available_holidays_report"/>
</record>
</record>
<menuitem name="Available Holidays" id="menu_hr_available_holidays_report_tree" action="action_hr_available_holidays_report" parent="menu_hr_reporting_holidays"/>
</data>
</openerp>

View File

@ -234,8 +234,8 @@ class report_custom(report_rml):
continue
dept_done=0
for d in range(0,len(result)):
emp_id[d]=pooler.get_pool(cr.dbname).get('hr.employee').search(cr, uid, [('user_id','=',result[d][0])])
items = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, emp_id[d], ['id','name'])
emp_id[d]=pooler.get_pool(cr.dbname).get('hr.employee').search(cr, uid, [('user_id', '=', result[d][0])])
items = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, emp_id[d], ['id', 'name'])
for item in items:
# if item['id'] in done:
# continue
@ -261,5 +261,6 @@ class report_custom(report_rml):
return xml
report_custom('report.holidays.summary', 'hr.holidays', '', 'addons/hr_holidays/report/holidays_summary.xsl')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import tools
from osv import fields,osv
@ -70,8 +71,8 @@ class hr_holidays_report(osv.osv):
s.state
from
hr_holidays s
where type='remove'
group by
WHERE type='remove'
GROUP BY
s.create_date,s.state,s.date_from,s.date_to,
s.employee_id,s.user_id,s.holiday_status_id,
s.department_id, s.category_id
@ -89,26 +90,26 @@ class hr_holidays_remaining_leaves_user(osv.osv):
'no_of_leaves': fields.integer('Remaining leaves'),
'user_id': fields.many2one('res.users', 'User'),
'leave_type': fields.char('Leave Type', size=64),
}
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'hr_holidays_remaining_leaves_user')
cr.execute("""
create or replace view hr_holidays_remaining_leaves_user as (
select
CREATE or REPLACE view hr_holidays_remaining_leaves_user as (
SELECT
min(hrs.id) as id,
rr.name as name,
sum(hrs.number_of_days) as no_of_leaves,
rr.user_id as user_id,
hhs.name as leave_type
from
FROM
hr_holidays as hrs, hr_employee as hre,
resource_resource as rr,hr_holidays_status as hhs
where
WHERE
hrs.employee_id = hre.id and
hre.resource_id = rr.id and
hhs.id = hrs.holiday_status_id
group by
GROUP BY
rr.name,rr.user_id,hhs.name
)
""")

View File

@ -45,37 +45,23 @@
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-personal" string="Employee"
domain="[('category_id', '=', False)]"
<filter icon="terp-personal" string="Employee" domain="[('category_id', '=', False)]"
help="Leaves by empolyee"/>
<filter icon="terp-stock_symbol-selection" string="Category"
domain="[('employee_id', '=', False)]"
<filter icon="terp-stock_symbol-selection" string="Category" domain="[('employee_id', '=', False)]"
help="Leaves by category"/>
<separator orientation="vertical"/>
<filter icon="terp-go-year" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
<filter icon="terp-go-month" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this month"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Leaves during last 7 days"/>
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]" help="Leaves in this year"/>
<filter icon="terp-go-month" string="This Month" name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" help="Leaves in this month"/>
<filter icon="terp-go-week" string=" 7 Days " separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Leaves during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-document-new"
domain="[('state','=','draft')]"
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]"
help = "Draft Leaves"/>
<filter string="Waiting Validation"
icon="terp-gtk-media-pause"
domain="[('state', '=' ,'confirm')]"
<filter string="Waiting Validation" icon="terp-gtk-media-pause" domain="[('state', '=' ,'confirm')]"
help = "In progress Leaves"/>
<filter string="Validated"
icon="terp-camera_test"
domain="[('state','=','validate')]"
<filter string="Validated" icon="terp-camera_test" domain="[('state','=','validate')]"
help = "Pending Leaves"/>
<separator orientation="vertical"/>
<field name="employee_id" widget="selection"/>
@ -96,18 +82,14 @@
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-gtk-stop"
string="Refused"
name="done"
<filter icon="terp-gtk-stop" string="Refused" name="done"
domain="[('state','=','refuse')]"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<separator orientation="vertical"/>
<field name="holiday_status_id" widget="selection"/>
<newline/>
<filter icon="terp-gtk-stop"
string="Cancelled"
domain="[('state','=','cancel')]"/>
<filter icon="terp-gtk-stop" string="Cancelled" domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="date_to"/>
<separator orientation="vertical"/>
@ -122,7 +104,7 @@
<field name="res_model">hr.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_user_id": uid, 'search_default_month':1,'search_default_Employee':1,'group_by':[]}</field>
<field name="context">{"search_default_user_id": uid, 'search_default_month':1, 'search_default_Employee':1, 'group_by':[]} </field>
<field name="search_view_id" ref="view_hr_holidays_report_search"/>
</record>

View File

@ -31,12 +31,12 @@ class hr_holidays_summary_dept(osv.osv_memory):
'date_from': fields.date('From', required=True),
'depts': fields.many2many('hr.department', 'summary_dept_rel', 'sum_id', 'dept_id', 'Department(s)'),
'holiday_type': fields.selection([('Validated','Validated'),('Confirmed','Confirmed'),('both','Both Validated and Confirmed')], 'Select Holiday Type', required=True)
}
}
_defaults = {
'date_from': time.strftime('%Y-%m-%d'),
'holiday_type': 'Validated'
}
}
def print_report(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [])[0]
@ -55,4 +55,5 @@ class hr_holidays_summary_dept(osv.osv_memory):
}
hr_holidays_summary_dept()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,12 +30,12 @@ class hr_holidays_summary_employee(osv.osv_memory):
'date_from': fields.date('From', required=True),
'emp': fields.many2many('hr.employee', 'summary_emp_rel', 'sum_id', 'emp_id', 'Employee(s)'),
'holiday_type': fields.selection([('Validated','Validated'),('Confirmed','Confirmed'),('both','Both Validated and Confirmed')], 'Select Holiday Type', required=True)
}
}
_defaults = {
'date_from': time.strftime('%Y-%m-%d'),
'holiday_type': 'Validated',
}
}
def print_report(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [])[0]
@ -53,4 +53,4 @@ class hr_holidays_summary_employee(osv.osv_memory):
hr_holidays_summary_employee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: