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

View File

@ -27,9 +27,8 @@ from tools.translate import _
class hr_employee_category(osv.osv): class hr_employee_category(osv.osv):
_name = "hr.employee.category" _name = "hr.employee.category"
_description = "Employee Category" _description = "Employee Category"
_columns = { _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), 'parent_id': fields.many2one('hr.employee.category', 'Parent Category', select=True),
'child_ids': fields.one2many('hr.employee.category', 'parent_id', 'Child Categories') '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): def _check_recursion(self, cr, uid, ids):
level = 100 level = 100
while len(ids): 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())) ids = filter(None, map(lambda x:x[0], cr.fetchall()))
if not level: if not level:
return False return False
@ -54,13 +53,14 @@ class hr_employee_marital_status(osv.osv):
_name = "hr.employee.marital.status" _name = "hr.employee.marital.status"
_description = "Employee Marital Status" _description = "Employee Marital Status"
_columns = { _columns = {
'name' : fields.char('Marital Status', size=30, required=True), 'name': fields.char('Marital Status', size=30, required=True),
'description' : fields.text('Status Description'), 'description': fields.text('Status Description'),
} }
hr_employee_marital_status() hr_employee_marital_status()
class hr_job(osv.osv): 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 = {} res = {}
for emp in self.browse(cr, uid, ids): for emp in self.browse(cr, uid, ids):
res[emp.id] = len(emp.employee_ids or []) res[emp.id] = len(emp.employee_ids or [])
@ -70,19 +70,19 @@ class hr_job(osv.osv):
_description = "Job Description" _description = "Job Description"
_columns = { _columns = {
'name': fields.char('Job Name', size=128, required=True, select=True), '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'), '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'), 'description': fields.text('Job Description'),
'requirements':fields.text('Requirements'), 'requirements': fields.text('Requirements'),
'department_id':fields.many2one('hr.department','Department'), 'department_id': fields.many2one('hr.department', 'Department'),
'company_id': fields.many2one('res.company', 'Company'), '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 = { _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), '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() hr_job()
@ -90,17 +90,17 @@ hr_job()
class hr_employee(osv.osv): class hr_employee(osv.osv):
_name = "hr.employee" _name = "hr.employee"
_description = "Employee" _description = "Employee"
_inherits = {'resource.resource':"resource_id"} _inherits = {'resource.resource': "resource_id"}
_columns = { _columns = {
'country_id' : fields.many2one('res.country', 'Nationality'), 'country_id': fields.many2one('res.country', 'Nationality'),
'birthday' : fields.date("Birthday"), 'birthday': fields.date("Birthday"),
'ssnid': fields.char('SSN No', size=32, help='Social Security Number'), 'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
'sinid': fields.char('SIN No', size=32), 'sinid': fields.char('SIN No', size=32),
'otherid': fields.char('Other ID', 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'), 'marital': fields.many2one('hr.employee.marital.status', 'Marital Status'),
'bank_account': fields.char('Bank Account', size=56), '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'), 'department_id':fields.many2one('hr.department','Department'),
'address_id': fields.many2one('res.partner.address', 'Working Address'), 'address_id': fields.many2one('res.partner.address', 'Working Address'),
'address_home_id': fields.many2one('res.partner.address', 'Home 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), 'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'), 'notes': fields.text('Notes'),
'parent_id': fields.many2one('hr.employee', 'Manager', select=True), 'parent_id': fields.many2one('hr.employee', 'Manager', select=True),
'category_id' : fields.many2one('hr.employee.category', 'Category'), 'category_id': fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'), 'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade'), 'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade'),
'coach_id': fields.many2one('res.users', 'Coach'), 'coach_id': fields.many2one('res.users', 'Coach'),
'job_id': fields.many2one('hr.job', 'Job'), 'job_id': fields.many2one('hr.job', 'Job'),
@ -123,7 +123,7 @@ class hr_employee(osv.osv):
'rb') .read().encode('base64') 'rb') .read().encode('base64')
_defaults = { _defaults = {
'active' : 1, 'active': 1,
'photo': _get_photo, 'photo': _get_photo,
} }

View File

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

View File

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

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="view_hr_installer" model="ir.ui.view"> <record id="view_hr_installer" model="ir.ui.view">
<field name="name">hr.installer.view</field> <field name="name">hr.installer.view</field>
<field name="model">hr.installer</field> <field name="model">hr.installer</field>
@ -7,20 +9,18 @@
<field name="inherit_id" ref="base.res_config_installer"/> <field name="inherit_id" ref="base.res_config_installer"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>
<form position="attributes"> <form position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute> <attribute name="string">Select Human Resources Modules To Install</attribute>
</form> </form>
<separator string="title" position="attributes">
<separator string="title" position="attributes"> <attribute name="string">Select Human Resources Modules To Install</attribute>
<attribute name="string">Select Human Resources Modules To Install</attribute> </separator>
</separator> <xpath expr='//separator[@string="vsep"]' position='attributes'>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute> <attribute name='string'></attribute>
</xpath> </xpath>
<xpath expr="//label[@string='description']" <xpath expr="//label[@string='description']" position="attributes">
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>
<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>
<group colspan="8"> <group colspan="8">
<field name="hr_holidays"/> <field name="hr_holidays"/>
<field name="hr_expense"/> <field name="hr_expense"/>
@ -51,16 +51,18 @@
<field name="action_id" ref="action_hr_installer"/> <field name="action_id" ref="action_hr_installer"/>
<field name="sequence">3</field> <field name="sequence">3</field>
</record> </record>
<record id="hr_ir_actions_todo_tree" model="ir.ui.view">
<field name="model">ir.actions.todo</field> <record id="hr_ir_actions_todo_tree" model="ir.ui.view">
<field name="name">hr_installer_action_replace</field> <field name="model">ir.actions.todo</field>
<field name="type">tree</field> <field name="name">hr_installer_action_replace</field>
<field name="inherit_id" ref="base.ir_actions_todo_tree"/> <field name="type">tree</field>
<field name="arch" type="xml"> <field name="inherit_id" ref="base.ir_actions_todo_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@string='Launch']" position="replace"> <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"/> <button name="%(action_hr_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/>
</xpath> </xpath>
</field> </field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

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

View File

@ -23,29 +23,28 @@ from osv import fields, osv
class hr_installer(osv.osv_memory): class hr_installer(osv.osv_memory):
_name = 'hr.installer' _name = 'hr.installer'
_inherit = 'res.config.installer' _inherit = 'res.config.installer'
_columns = { _columns = {
# Human Resources Management # 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." help="Tracks employee leaves allocations, requests and planning."
"\n\nCan also plug into OpenERP's agendas and calendars " "\n\nCan also plug into OpenERP's agendas and calendars "
"applications in order to display accepted leaves requests on" "applications in order to display accepted leaves requests on"
" OpenERP's calendars."), " OpenERP's calendars."),
'hr_expense':fields.boolean('Expenses', 'hr_expense': fields.boolean('Expenses',
help="Tracks and manages employee expenses, and can " help="Tracks and manages employee expenses, and can "
"automatically re-invoice clients if the expenses are " "automatically re-invoice clients if the expenses are "
"project-related."), "project-related."),
'hr_recruitment':fields.boolean('Recruitment Process', 'hr_recruitment': fields.boolean('Recruitment Process',
help="Helps you manage and streamline your recruitment process."), help="Helps you manage and streamline your recruitment process."),
'hr_timesheet_sheet':fields.boolean('Timesheets', 'hr_timesheet_sheet':fields.boolean('Timesheets',
help="Tracks and helps employees encode and validate timesheets " help="Tracks and helps employees encode and validate timesheets "
"and attendance."), "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."), 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 " help="Lets you create and manage the periodic evaluation and "
"performance review of employees."), "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."), help="Simplifies the management of employee attendances."),
} }
_defaults = { _defaults = {
@ -55,4 +54,4 @@ class hr_installer(osv.osv_memory):
hr_installer() 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"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<record id="group_hr_manager" model="res.groups"> <record id="group_hr_manager" model="res.groups">
<field name="name">Human Resources / Manager</field> <field name="name">Human Resources / Manager</field>
</record> </record>
<record id="group_hr_user" model="res.groups"> <record id="group_hr_user" model="res.groups">
<field name="name">Human Resources / User</field> <field name="name">Human Resources / User</field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

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

View File

@ -19,7 +19,6 @@
# #
############################################################################## ##############################################################################
from mx import DateTime
import time import time
from osv import fields, osv from osv import fields, osv
@ -29,16 +28,16 @@ class hr_action_reason(osv.osv):
_name = "hr.action.reason" _name = "hr.action.reason"
_description = "Action Reason" _description = "Action Reason"
_columns = { _columns = {
'name' : fields.char('Reason', size=64, required=True, help='Specifies the reason for Signing In/Signing Out.'), '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"), 'action_type': fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')], "Action's type"),
} }
_defaults = { _defaults = {
'action_type' : lambda *a: 'sign_in', 'action_type': 'sign_in',
} }
hr_action_reason() hr_action_reason()
def _employee_get(obj, cr, uid, context=None): 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: if ids:
return ids[0] return ids[0]
return False return False
@ -51,18 +50,18 @@ class hr_attendance(osv.osv):
res = dict.fromkeys(ids, '') res = dict.fromkeys(ids, '')
for obj in self.browse(cr, uid, ids, context=context): 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')) res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S'))
return res return res
_columns = { _columns = {
'name' : fields.datetime('Date', required=True, select=1), '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': 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.'), '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), '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), 'day': fields.function(_day_compute, method=True, type='char', string='Day', store=True, select=1, size=32),
} }
_defaults = { _defaults = {
'name' : lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'name': time.strftime('%Y-%m-%d %H:%M:%S'),
'employee_id' : _employee_get, 'employee_id': _employee_get,
} }
def _altern_si_so(self, cr, uid, ids): 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) and name <= (select name from hr_attendance where id=%s)
order by name desc order by name desc
limit 2 ''' limit 2 '''
cr.execute(sql,(id,id)) cr.execute(sql,(id,id))
atts = cr.fetchall() 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])): 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'), '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,)) cr.execute('select max(name) from hr_attendance where employee_id=%s', (emp_id,))
res = cr.fetchone() res = cr.fetchone()
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S')))) 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 id = False
warning_sign = 'sign' warning_sign = 'sign'
#Special case when button calls this method :type=context #Special case when button calls this method :type=context
if isinstance(type,dict): if isinstance(type, dict):
type = type.get('type','action') type = type.get('type','action')
if type == 'sign_in': if type == 'sign_in':
warning_sign = "Sign In" warning_sign = "Sign In"
elif type == 'sign_out': elif type == 'sign_out':
@ -135,15 +132,15 @@ class hr_employee(osv.osv):
if not self._action_check(cr, uid, emp['id'], dt, context): 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,)) 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: if dt:
res['name'] = dt res['name'] = dt
id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) id = self.pool.get('hr.attendance').create(cr, uid, res, context=context)
if type != 'action': if type != 'action':
return id return id
return True return True
hr_employee() hr_employee()

View File

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

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <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"/> <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> </data>
</openerp> </openerp>

View File

@ -8,13 +8,14 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Employee attendance"> <form string="Employee attendance">
<field name="employee_id" select="1"/> <field name="employee_id" />
<field name="name" select="1"/> <field name="name" />
<field name="action" select="1"/> <field name="action" />
<field name="action_desc" select="1"/> <field name="action_desc" />
</form> </form>
</field> </field>
</record> </record>
<record id="view_attendance_tree" model="ir.ui.view"> <record id="view_attendance_tree" model="ir.ui.view">
<field name="name">hr.attendance.tree</field> <field name="name">hr.attendance.tree</field>
<field name="model">hr.attendance</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-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)]" /> <filter icon="terp-go-today" string="Today" domain="[('name::date','=',current_date)]" />
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="employee_id" select="1" /> <field name="employee_id" />
<field name="name" select="1" /> <field name="name" />
<field name="action" select="1" /> <field name="action" />
<newline/> <newline/>
<group expand="0" string="Group By..."> <group expand="0" string="Group By...">
<filter name="employee" string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/> <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" <!--<menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root"
groups="group_hr_attendance"/>--> groups="group_hr_attendance"/>-->
<menuitem <menuitem id="menu_hr_time_tracking" name="Time Tracking" parent="hr.menu_hr_root" sequence="3"/>
id="menu_hr_time_tracking" <menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_time_tracking" groups="hr.group_hr_manager" sequence="3"/>
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"> <record id="edit_attendance_reason" model="ir.ui.view">
<field name="name">hr.action.reason.form</field> <field name="name">hr.action.reason.form</field>
@ -87,11 +84,12 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Define attendance reason"> <form string="Define attendance reason">
<field colspan="4" name="name" select="1"/> <field colspan="4" name="name" />
<field name="action_type" select="1"/> <field name="action_type" />
</form> </form>
</field> </field>
</record> </record>
<record id="view_attendance_reason" model="ir.ui.view"> <record id="view_attendance_reason" model="ir.ui.view">
<field name="name">hr.action.reason.tree</field> <field name="name">hr.action.reason.tree</field>
<field name="model">hr.action.reason</field> <field name="model">hr.action.reason</field>
@ -103,6 +101,7 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="open_view_attendance_reason" model="ir.actions.act_window"> <record id="open_view_attendance_reason" model="ir.actions.act_window">
<field name="name">Attendance Reasons</field> <field name="name">Attendance Reasons</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -111,6 +110,7 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="view_attendance_reason"/> <field name="view_id" ref="view_attendance_reason"/>
</record> </record>
<menuitem sequence="9" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Leaves"/> <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"/> <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"/>--> groups="group_hr_attendance"/>-->
<!--Time Tracking menu for Project Management--> <!--Time Tracking menu for Project Management-->
<menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/> <menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/>
<menuitem <menuitem id="base.menu_project_management_time_tracking" name="Time Tracking"
id="base.menu_project_management_time_tracking"
name="Time Tracking"
parent="base.menu_main_pm" sequence="3"/> 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"/> <!--<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 import time
from report import report_sxw from report import report_sxw
import pooler import pooler
import datetime import datetime
class attendance_print(report_sxw.rml_parse): class attendance_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context): def __init__(self, cr, uid, name, context):
super(attendance_print, self).__init__(cr, uid, name, context=context) super(attendance_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update({ self.localcontext.update({
@ -80,14 +80,13 @@ class attendance_print(report_sxw.rml_parse):
total2 += r['delay'] total2 += r['delay']
result_dict = { result_dict = {
'total' : total and str(total).split('.')[0], 'total': total and str(total).split('.')[0],
'total2' : total2 and str(total2).split('.')[0] 'total2': total2 and str(total2).split('.')[0]
} }
# return (self._sign(total),total2 and self._sign(total2)) # return (self._sign(total),total2 and self._sign(total2))
return [result_dict] 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: # 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 from report.interface import toxml
one_day = DateTime.RelativeDateTime(days=1) 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): def hour2str(h):
hours = int(h) hours = int(h)
@ -38,7 +38,10 @@ def hour2str(h):
return '%02dh%02d' % (hours, minutes) return '%02dh%02d' % (hours, minutes)
class report_custom(report_rml): 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) month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1)
user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year]
for employee_id in ids: for employee_id in ids:
@ -67,7 +70,7 @@ class report_custom(report_rml):
if attendences and attendences[0]['action'] == 'sign_out': if attendences and attendences[0]['action'] == 'sign_out':
attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
if attendences and attendences[-1]['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 # sum up the attendances' durations
for att in attendences: for att in attendences:
dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
@ -88,7 +91,6 @@ class report_custom(report_rml):
%s %s
</report> </report>
''' % '\n'.join(user_xml) ''' % '\n'.join(user_xml)
return xml return xml
report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl') 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 import DateTime
from mx.DateTime import now from mx.DateTime import now
import netsvc
import pooler import pooler
from report.interface import report_rml from report.interface import report_rml
@ -35,13 +35,12 @@ def to_hour(h):
return int(h), int(round((h - int(h)) * 60, 0)) return int(h), int(round((h - int(h)) * 60, 0))
class report_custom(report_rml): 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') start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d')
end_date = DateTime.strptime(datas['form']['end_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) 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) last_monday = end_date + DateTime.RelativeDateTime(days=7 - end_date.day_of_week)
if last_monday < first_monday: if last_monday < first_monday:
first_monday, last_monday = 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 # 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 # 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': 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': 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 # sum up the attendances' durations
for att in attendances: for att in attendances:
dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')

View File

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

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import time import time
from osv import osv, fields from osv import osv, fields
@ -26,16 +27,17 @@ class hr_attendance_bymonth(osv.osv_memory):
_name = 'hr.attendance.month' _name = 'hr.attendance.month'
_description = 'Print Monthly Attendance Report' _description = 'Print Monthly Attendance Report'
_columns = { _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': 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', required=True),
'year': fields.integer('Year', required=True) 'year': fields.integer('Year', required=True)
} }
_defaults = { _defaults = {
'month': lambda * a: time.gmtime()[1], 'month': time.gmtime()[1],
'year': lambda * a: time.gmtime()[0], 'year': time.gmtime()[0],
} }
def print_report(self, cr, uid, ids, context=None): def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = { datas = {
'ids': [], 'ids': [],
'model': 'hr.employee', 'model': 'hr.employee',
@ -49,4 +51,4 @@ class hr_attendance_bymonth(osv.osv_memory):
hr_attendance_bymonth() 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"> <field name="arch" type="xml">
<form string="Print Attendance Report Monthly"> <form string="Print Attendance Report Monthly">
<group col="4" colspan="6"> <group col="4" colspan="6">
<field name="month"/> <field name="month"/>
<field name="year"/> <field name="year"/>
<newline/> <newline/>
</group> </group>
<separator colspan="4"/> <separator colspan="4"/>
<group col="2" colspan="4"> <group col="2" colspan="4">
@ -42,4 +42,4 @@
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -28,11 +28,11 @@ class hr_attendance_byweek(osv.osv_memory):
_columns = { _columns = {
'init_date': fields.date('Starting Date', required=True), 'init_date': fields.date('Starting Date', required=True),
'end_date': fields.date('Ending Date', required=True) 'end_date': fields.date('Ending Date', required=True)
} }
_defaults = { _defaults = {
'init_date': lambda *a: time.strftime('%Y-%m-%d'), 'init_date': time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'), 'end_date': time.strftime('%Y-%m-%d'),
} }
def print_report(self, cr, uid, ids, context=None): def print_report(self, cr, uid, ids, context=None):
datas = { datas = {
@ -47,4 +47,4 @@ class hr_attendance_byweek(osv.osv_memory):
} }
hr_attendance_byweek() 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"> <field name="arch" type="xml">
<form string="Print Attendance Report Weekly"> <form string="Print Attendance Report Weekly">
<group col="4" colspan="6"> <group col="4" colspan="6">
<separator string="Select a starting and a end date" colspan="4"/> <separator string="Select a starting and a end date" colspan="4"/>
<field name="init_date"/> <field name="init_date"/>
<field name="end_date"/> <field name="end_date"/>
<newline/> <newline/>
</group> </group>
<separator colspan="4"/> <separator colspan="4"/>
<group col="2" colspan="4"> <group col="2" colspan="4">
@ -43,4 +43,4 @@
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -31,15 +31,16 @@ class hr_attendance_error(osv.osv_memory):
'init_date': fields.date('Starting Date', required=True), 'init_date': fields.date('Starting Date', required=True),
'end_date': fields.date('Ending Date', required=True), 'end_date': fields.date('Ending Date', required=True),
'max_delay': fields.integer('Max. Delay (Min)', required=True) 'max_delay': fields.integer('Max. Delay (Min)', required=True)
}
}
_defaults = { _defaults = {
'init_date': lambda *a: time.strftime('%Y-%m-%d'), 'init_date': time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'), 'end_date': time.strftime('%Y-%m-%d'),
'max_delay': 120, 'max_delay': 120,
} }
def print_report(self, cr, uid, ids, context=None): def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
emp_ids = [] emp_ids = []
data_error = self.read(cr, uid, ids)[0] data_error = self.read(cr, uid, ids)[0]
date_from = data_error['init_date'] date_from = data_error['init_date']
@ -67,4 +68,4 @@ class hr_attendance_error(osv.osv_memory):
hr_attendance_error() 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"> <field name="arch" type="xml">
<form string="Print Attendance Report Error"> <form string="Print Attendance Report Error">
<group col="4" colspan="6"> <group col="4" colspan="6">
<separator string="Analysis Information" colspan="4"/> <separator string="Analysis Information" colspan="4"/>
<field name="init_date"/> <field name="init_date"/>
<field name="end_date"/> <field name="end_date"/>
<field name="max_delay"/> <field name="max_delay"/>
<label string="Bellow this delay, the error is considered to be voluntary" colspan="2"/> <label string="Bellow this delay, the error is considered to be voluntary" colspan="2"/>
<newline/> <newline/>
</group> </group>
<separator colspan="4"/> <separator colspan="4"/>
<group col="2" colspan="4"> <group col="2" colspan="4">
@ -45,4 +45,4 @@
</record> </record>
</data> </data>
</openerp> </openerp>

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ class hr_employee(osv.osv):
'vehicle': fields.char('Company Vehicle', size=64), 'vehicle': fields.char('Company Vehicle', size=64),
'vehicle_distance': fields.integer('Home-Work Distance', help="In kilometers"), 'vehicle_distance': fields.integer('Home-Work Distance', help="In kilometers"),
'contract_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'), 'contract_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'),
} }
hr_employee() hr_employee()
#Contract wage type period name #Contract wage type period name
@ -44,10 +44,10 @@ class hr_contract_wage_type_period(osv.osv):
_columns = { _columns = {
'name': fields.char('Period Name', size=50, required=True, select=True), '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') '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 = { _defaults = {
'factor_days': lambda *args: 168.0 'factor_days': 168.0
} }
hr_contract_wage_type_period() hr_contract_wage_type_period()
#Contract wage type (hourly, daily, monthly, ...) #Contract wage type (hourly, daily, monthly, ...)
@ -55,15 +55,15 @@ class hr_contract_wage_type(osv.osv):
_name = 'hr.contract.wage.type' _name = 'hr.contract.wage.type'
_description = 'Wage Type' _description = 'Wage Type'
_columns = { _columns = {
'name' : fields.char('Wage Type Name', size=50, required=True, select=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), 'period_id': fields.many2one('hr.contract.wage.type.period', 'Wage Period', required=True),
'type' : fields.selection([('gross','Gross'), ('net','Net')], 'Type', 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') '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 = { _defaults = {
'type' : lambda *a : 'gross', 'type': 'gross',
'factor_type': lambda *args: 1.8 'factor_type': 1.8
} }
hr_contract_wage_type() hr_contract_wage_type()
@ -93,10 +93,11 @@ class hr_contract(osv.osv):
'advantages_net': fields.float('Net Advantages Value', digits=(16,2)), 'advantages_net': fields.float('Net Advantages Value', digits=(16,2)),
'advantages_gross': fields.float('Gross Advantages Value', digits=(16,2)), 'advantages_gross': fields.float('Gross Advantages Value', digits=(16,2)),
'notes': fields.text('Notes'), 'notes': fields.text('Notes'),
} }
_defaults = { _defaults = {
'date_start' : lambda *a : time.strftime("%Y-%m-%d"), 'date_start': time.strftime("%Y-%m-%d"),
} }
hr_contract() hr_contract()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="survey_2" model="survey"> <record id="survey_2" model="survey">
<field name="title">Employee Evaluation</field> <field name="title">Employee Evaluation</field>
<field name="max_response_limit">20</field> <field name="max_response_limit">20</field>
@ -10,6 +11,7 @@
<field name="response_user">5</field> <field name="response_user">5</field>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_3" model="survey"> <record id="survey_3" model="survey">
<field name="title">Employee Opinion</field> <field name="title">Employee Opinion</field>
@ -20,6 +22,7 @@
<field name="response_user">5</field> <field name="response_user">5</field>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_page_1" model="survey.page"> <record id="survey_page_1" model="survey.page">
<field name="title">Employee Evaluation Form</field> <field name="title">Employee Evaluation Form</field>
@ -27,6 +30,7 @@
<field eval="1" name="sequence"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_page_2" model="survey.page"> <record id="survey_page_2" model="survey.page">
<field name="title">Process</field> <field name="title">Process</field>
@ -42,6 +46,7 @@
<field eval="2" name="sequence"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_page_6" model="survey.page"> <record id="survey_page_6" model="survey.page">
<field name="title">Employee Performance In Key Areas</field> <field name="title">Employee Performance In Key Areas</field>
@ -81,8 +86,6 @@
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_0" model="survey.question"> <record id="survey_question_0" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -132,6 +135,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_3" model="survey.question"> <record id="survey_question_3" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -156,6 +160,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_4" model="survey.question"> <record id="survey_question_4" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -203,6 +208,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<!--record id="survey_question_7" model="survey.question"> <!--record id="survey_question_7" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -227,6 +233,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record--> </record-->
</data> </data>
<data> <data>
<record id="survey_question_8" model="survey.question"> <record id="survey_question_8" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -304,8 +311,6 @@
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_14" model="survey.question"> <record id="survey_question_14" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -331,7 +336,6 @@
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_17" model="survey.question"> <record id="survey_question_17" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -356,6 +360,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_18" model="survey.question"> <record id="survey_question_18" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -381,8 +386,6 @@
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_23" model="survey.question"> <record id="survey_question_23" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -436,6 +439,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_40" model="survey.question"> <record id="survey_question_40" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -460,6 +464,7 @@
<field eval="0" name="allow_comment"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_41" model="survey.question"> <record id="survey_question_41" model="survey.question">
<field name="in_visible_answer_type">1</field> <field name="in_visible_answer_type">1</field>
@ -502,7 +507,6 @@
<field name="type">descriptive_text</field> <field name="type">descriptive_text</field>
<field name="comment_valid_err_msg">The comment you entered is in an invalid format.</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. <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> * 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="0" name="make_comment_field"/>
<field eval="1" name="in_visible_menu_choice"/> <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> </record>
</data> </data>
<!--data> <!--data>
<record id="survey_question_42" model="survey.question"> <record id="survey_question_42" model="survey.question">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="0" name="allow_comment"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_4" model="survey.question.column.heading"> <record id="survey_question_column_heading_4" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_4"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_5" model="survey.question.column.heading"> <record id="survey_question_column_heading_5" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_4"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_6" model="survey.question.column.heading"> <record id="survey_question_column_heading_6" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_4"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_7" model="survey.question.column.heading"> <record id="survey_question_column_heading_7" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_4"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_8" model="survey.question.column.heading"> <record id="survey_question_column_heading_8" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_4"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_9" model="survey.question.column.heading"> <record id="survey_question_column_heading_9" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_8"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_10" model="survey.question.column.heading"> <record id="survey_question_column_heading_10" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_8"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_11" model="survey.question.column.heading"> <record id="survey_question_column_heading_11" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_8"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_12" model="survey.question.column.heading"> <record id="survey_question_column_heading_12" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_8"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_13" model="survey.question.column.heading"> <record id="survey_question_column_heading_13" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_8"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_14" model="survey.question.column.heading"> <record id="survey_question_column_heading_14" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_3"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_15" model="survey.question.column.heading"> <record id="survey_question_column_heading_15" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_3"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_16" model="survey.question.column.heading"> <record id="survey_question_column_heading_16" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_3"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_17" model="survey.question.column.heading"> <record id="survey_question_column_heading_17" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_3"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_18" model="survey.question.column.heading"> <record id="survey_question_column_heading_18" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_3"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_19" model="survey.question.column.heading"> <record id="survey_question_column_heading_19" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_6"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_20" model="survey.question.column.heading"> <record id="survey_question_column_heading_20" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_6"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_21" model="survey.question.column.heading"> <record id="survey_question_column_heading_21" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_6"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_22" model="survey.question.column.heading"> <record id="survey_question_column_heading_22" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_6"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_23" model="survey.question.column.heading"> <record id="survey_question_column_heading_23" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_6"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_24" model="survey.question.column.heading"> <record id="survey_question_column_heading_24" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_10"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_25" model="survey.question.column.heading"> <record id="survey_question_column_heading_25" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_10"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_26" model="survey.question.column.heading"> <record id="survey_question_column_heading_26" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_10"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_27" model="survey.question.column.heading"> <record id="survey_question_column_heading_27" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_10"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_28" model="survey.question.column.heading"> <record id="survey_question_column_heading_28" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_10"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_29" model="survey.question.column.heading"> <record id="survey_question_column_heading_29" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_14"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_30" model="survey.question.column.heading"> <record id="survey_question_column_heading_30" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_14"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_31" model="survey.question.column.heading"> <record id="survey_question_column_heading_31" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_14"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_32" model="survey.question.column.heading"> <record id="survey_question_column_heading_32" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_14"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_33" model="survey.question.column.heading"> <record id="survey_question_column_heading_33" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_14"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_34" model="survey.question.column.heading"> <record id="survey_question_column_heading_34" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_18"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_35" model="survey.question.column.heading"> <record id="survey_question_column_heading_35" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_18"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_36" model="survey.question.column.heading"> <record id="survey_question_column_heading_36" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_18"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_37" model="survey.question.column.heading"> <record id="survey_question_column_heading_37" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_18"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_38" model="survey.question.column.heading"> <record id="survey_question_column_heading_38" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_18"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_39" model="survey.question.column.heading"> <record id="survey_question_column_heading_39" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_40"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_40" model="survey.question.column.heading"> <record id="survey_question_column_heading_40" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_40"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_41" model="survey.question.column.heading"> <record id="survey_question_column_heading_41" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_40"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_42" model="survey.question.column.heading"> <record id="survey_question_column_heading_42" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_40"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_question_column_heading_43" model="survey.question.column.heading"> <record id="survey_question_column_heading_43" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_1" model="survey.answer"> <record id="survey_answer_1" model="survey.answer">
<field name="answer">Name</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_2" model="survey.answer"> <record id="survey_answer_2" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_3" model="survey.answer"> <record id="survey_answer_3" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_4" model="survey.answer"> <record id="survey_answer_4" model="survey.answer">
<field name="in_visible_answer_type">0</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_5" model="survey.answer"> <record id="survey_answer_5" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_6" model="survey.answer"> <record id="survey_answer_6" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_7" model="survey.answer"> <record id="survey_answer_7" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="1" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_8" model="survey.answer"> <record id="survey_answer_8" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_9" model="survey.answer"> <record id="survey_answer_9" model="survey.answer">
<field name="in_visible_answer_type">0</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_10" model="survey.answer"> <record id="survey_answer_10" model="survey.answer">
<field name="answer">Position Title</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_11" model="survey.answer"> <record id="survey_answer_11" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_12" model="survey.answer"> <record id="survey_answer_12" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_13" model="survey.answer"> <record id="survey_answer_13" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_14" model="survey.answer"> <record id="survey_answer_14" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_15" model="survey.answer"> <record id="survey_answer_15" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="2" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_16" model="survey.answer"> <record id="survey_answer_16" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_17" model="survey.answer"> <record id="survey_answer_17" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_18" model="survey.answer"> <record id="survey_answer_18" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_19" model="survey.answer"> <record id="survey_answer_19" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_20" model="survey.answer"> <record id="survey_answer_20" model="survey.answer">
<field name="answer">Appraisal for Period</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_21" model="survey.answer"> <record id="survey_answer_21" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="3" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_22" model="survey.answer"> <record id="survey_answer_22" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="4" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_23" model="survey.answer"> <record id="survey_answer_23" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="4" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_24" model="survey.answer"> <record id="survey_answer_24" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="4" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_25" model="survey.answer"> <record id="survey_answer_25" model="survey.answer">
<field name="answer">Date of Review</field> <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"/> <field eval="4" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_26" model="survey.answer"> <record id="survey_answer_26" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_27" model="survey.answer"> <record id="survey_answer_27" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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> </record>
</data> </data>
<data> <data>
<record id="survey_answer_31" model="survey.answer"> <record id="survey_answer_31" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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> </record>
</data> </data>
<data> <data>
<record id="survey_answer_43" model="survey.answer"> <record id="survey_answer_43" model="survey.answer">
<field name="answer">Appraiser</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_44" model="survey.answer"> <record id="survey_answer_44" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_45" model="survey.answer"> <record id="survey_answer_45" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_46" model="survey.answer"> <record id="survey_answer_46" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_47" model="survey.answer"> <record id="survey_answer_47" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_48" model="survey.answer"> <record id="survey_answer_48" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_49" model="survey.answer"> <record id="survey_answer_49" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_50" model="survey.answer"> <record id="survey_answer_50" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_51" model="survey.answer"> <record id="survey_answer_51" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_52" model="survey.answer"> <record id="survey_answer_52" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_68" model="survey.answer"> <record id="survey_answer_68" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_69" model="survey.answer"> <record id="survey_answer_69" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_70" model="survey.answer"> <record id="survey_answer_70" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_71" model="survey.answer"> <record id="survey_answer_71" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_72" model="survey.answer"> <record id="survey_answer_72" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_73" model="survey.answer"> <record id="survey_answer_73" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_74" model="survey.answer"> <record id="survey_answer_74" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_75" model="survey.answer"> <record id="survey_answer_75" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_76" model="survey.answer"> <record id="survey_answer_76" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_77" model="survey.answer"> <record id="survey_answer_77" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field eval="5" name="sequence"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_answer_78" model="survey.answer"> <record id="survey_answer_78" model="survey.answer">
<field name="in_visible_answer_type">1</field> <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"/> <field name="question_id" ref="survey_question_9"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_tbl_column_heading_results0" model="survey.question.column.heading"> <record id="survey_tbl_column_heading_results0" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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"/> <field name="question_id" ref="survey_question_9"/>
</record> </record>
</data> </data>
<data> <data>
<record id="survey_tbl_column_heading_comments0" model="survey.question.column.heading"> <record id="survey_tbl_column_heading_comments0" model="survey.question.column.heading">
<field name="in_visible_rating_weight">1</field> <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> </record>
</data> </data>
<!-- <data noupdate="1">--> <!-- <data noupdate="1">-->
<!-- <record id="survey_request_1" model="survey.request">--> <!-- <record id="survey_request_1" model="survey.request">-->
<!-- <field name="state">waiting_answer</field>--> <!-- <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>--> <!-- <field name="date_deadline">2010-02-21</field>-->
<!-- </record>--> <!-- </record>-->
<!-- </data>--> <!-- </data>-->
<data noupdate="1"> <data noupdate="1">
<record id="hr_evaluation_plan_managersevaluationplan0" model="hr_evaluation.plan"> <record id="hr_evaluation_plan_managersevaluationplan0" model="hr_evaluation.plan">
<field eval="1" name="active"/> <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"/> <field name="company_id" ref="base.main_company"/>
</record> </record>
</data> </data>
<data noupdate="1"> <data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtosubordinates0" model="hr_evaluation.plan.phase"> <record id="hr_evaluation_plan_phase_sendtosubordinates0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/> <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"/> <field eval="0" name="wait"/>
</record> </record>
</data> </data>
<data noupdate="1"> <data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtomanagers0" model="hr_evaluation.plan.phase"> <record id="hr_evaluation_plan_phase_sendtomanagers0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/> <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"/> <field eval="0" name="wait"/>
</record> </record>
</data> </data>
<data noupdate="1"> <data noupdate="1">
<record id="hr_evaluation_plan_phase_sendtoemployee0" model="hr_evaluation.plan.phase"> <record id="hr_evaluation_plan_phase_sendtoemployee0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/> <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"/> <field eval="0" name="wait"/>
</record> </record>
</data> </data>
<data noupdate="1"> <data noupdate="1">
<record id="hr_evaluation_plan_phase_finalinterviewwithmanager0" model="hr_evaluation.plan.phase"> <record id="hr_evaluation_plan_phase_finalinterviewwithmanager0" model="hr_evaluation.plan.phase">
<field name="plan_id" ref="hr_evaluation_plan_managersevaluationplan0"/> <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>-->
<data> <data>
<record forcecreate="True" id="ir_cron_scheduler_evaluation" <record forcecreate="True" id="ir_cron_scheduler_evaluation" model="ir.cron">
model="ir.cron">
<field name="name">Run Employee Evaluation</field> <field name="name">Run Employee Evaluation</field>
<field eval="True" name="active" /> <field eval="True" name="active" />
<field name="user_id" ref="base.user_root" /> <field name="user_id" ref="base.user_root" />

View File

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

View File

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import hr_evaluation_report 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import tools import tools
from osv import fields,osv from osv import fields,osv
@ -75,9 +76,9 @@ class hr_evaluation_report(osv.osv):
s.state s.state
from from
hr_evaluation_interview l hr_evaluation_interview l
left join LEFT JOIN
hr_evaluation_evaluation s on (s.id=l.evaluation_id) hr_evaluation_evaluation s on (s.id=l.evaluation_id)
group by GROUP BY
s.create_date, s.create_date,
date_trunc('day',s.create_date), date_trunc('day',s.create_date),
to_char(s.create_date, 'YYYY-MM-DD'), to_char(s.create_date, 'YYYY-MM-DD'),
@ -92,5 +93,8 @@ class hr_evaluation_report(osv.osv):
s.plan_id s.plan_id
) )
""") """)
hr_evaluation_report() 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"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="view_evaluation_report_tree" model="ir.ui.view"> <record id="view_evaluation_report_tree" model="ir.ui.view">
<field name="name">hr.evaluation.report.tree</field> <field name="name">hr.evaluation.report.tree</field>
<field name="model">hr.evaluation.report</field> <field name="model">hr.evaluation.report</field>
@ -43,33 +44,18 @@
<search string="Evaluations Analysis"> <search string="Evaluations Analysis">
<group> <group>
<filter icon="terp-go-year" string="365 Days" <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'))]" 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"/>
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-month" string="30 Days" <filter icon="terp-go-week" string=" 7 Days " separator="1"
name="month" 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=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"/> <separator orientation="vertical"/>
<filter string="Draft" <filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]"
icon="terp-document-new"
domain="[('state','=','draft')]"
help = "Draft Evaluations"/> help = "Draft Evaluations"/>
<filter string="Plan In Progress" <filter string="Plan In Progress" icon="terp-camera_test" domain="[('state', '=' ,'wait')]"
icon="terp-camera_test"
domain="[('state', '=' ,'wait')]"
help = "In progress Evaluations"/> help = "In progress Evaluations"/>
<filter string="Final Validation" <filter string="Final Validation" icon="terp-check" domain="[('state','=','progress')]"
icon="terp-check"
domain="[('state','=','progress')]"
help = "Final Validation Evaluations"/> help = "Final Validation Evaluations"/>
<filter icon="terp-dialog-close" <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="employee_id" widget="selection"/> <field name="employee_id" widget="selection"/>
<field name="plan_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="Month" icon="terp-go-month" context="{'group_by':'create_date'}"/>
<filter string="Year" icon="terp-go-month" context="{'group_by':'year'}"/> <filter string="Year" icon="terp-go-month" context="{'group_by':'year'}"/>
</group> </group>
<newline/> <newline/>
<group expand="0" string="Extended options..." groups="base.group_extended"> <group expand="0" string="Extended options..." groups="base.group_extended">
<field name="rating"/> <field name="rating"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="deadline"/> <field name="deadline"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="state"/> <field name="state"/>
</group> </group>
</search> </search>
</field> </field>
@ -110,5 +96,5 @@
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="10"/> <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"/> <menuitem action="action_evaluation_report_all" id="menu_evaluation_report_all" parent="hr.menu_hr_reporting" sequence="3"/>
</data> </data>
</openerp> </openerp>

View File

@ -21,5 +21,4 @@
import hr_evaluation_mail import hr_evaluation_mail
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # 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) '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') hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation')
evaluation_data = self.read(cr, uid, ids, context=context)[0] 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: 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() 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"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="view_hr_evaluation_send_mail" model="ir.ui.view">
<field name="name">hr.evaluation.send.mail</field> <record id="view_hr_evaluation_send_mail" model="ir.ui.view">
<field name="model">hr.evaluation.reminder</field> <field name="name">hr.evaluation.send.mail</field>
<field name="type">form</field> <field name="model">hr.evaluation.reminder</field>
<field name="arch" type="xml"> <field name="type">form</field>
<form string="Evaluation Reminders"> <field name="arch" type="xml">
<group width="340"> <form string="Evaluation Reminders">
<separator string="Send evaluation reminder" colspan="4"/> <group width="340">
<field name="evaluation_id"/> <separator string="Send evaluation reminder" colspan="4"/>
<separator colspan="4"/> <field name="evaluation_id"/>
<group colspan="4"> <separator colspan="4"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/> <group colspan="4">
<button name="send_mail" string="Send Mail" type="object" icon="gtk-ok"/> <button special="cancel" string="Cancel" icon="gtk-cancel"/>
</group> <button name="send_mail" string="Send Mail" type="object" icon="gtk-ok"/>
</group> </group>
</form> </group>
</field> </form>
</record> </field>
</record>
<record id="action_hr_evaluation_send_mail" model="ir.actions.act_window"> <record id="action_hr_evaluation_send_mail" model="ir.actions.act_window">
<field name="name">Evaluation Send Mail</field> <field name="name">Evaluation Send Mail</field>
<field name="res_model">hr.evaluation.reminder</field> <field name="res_model">hr.evaluation.reminder</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="view_hr_evaluation_send_mail"/> <field name="view_id" ref="view_hr_evaluation_send_mail"/>
<field name="context">{'record_id':active_id}</field> <field name="context">{'record_id':active_id}</field>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

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

View File

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

View File

@ -25,7 +25,7 @@ from osv import fields, osv
from tools.translate import _ from tools.translate import _
def _employee_get(obj, cr, uid, context=None): 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: if ids:
return ids[0] return ids[0]
return False return False
@ -34,15 +34,15 @@ class hr_expense_expense(osv.osv):
def copy(self, cr, uid, id, default=None, context=None): def copy(self, cr, uid, id, default=None, context=None):
if not default: default = {} 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) return super(hr_expense_expense, self).copy(cr, uid, id, default, context)
def _amount(self, cr, uid, ids, field_name, arg, context): 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),)) 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()) res = dict(cr.fetchall())
return res 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] user = self.pool.get('res.users').browse(cr, uid, [uid])[0]
if user.company_id: if user.company_id:
return user.company_id.currency_id.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 'fiscal_position': exp.employee_id.address_id.partner_id.property_account_position.id
} }
if payment_term_id: if payment_term_id:
to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], payment_term_id, None)
payment_term_id, None)
if to_update: if to_update:
inv.update(to_update['value']) inv.update(to_update['value'])
if exp.journal_id: if exp.journal_id:
inv['journal_id']=exp.journal_id.id inv['journal_id']=exp.journal_id.id
inv_id = invoice_obj.create(cr, uid, inv, {'type':'in_invoice'}) inv_id = invoice_obj.create(cr, uid, inv, {'type': 'in_invoice'})
invoice_obj.button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, invoice_obj.button_compute(cr, uid, [inv_id], {'type': 'in_invoice'}, set_total=True)
set_total=True)
self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'}) self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'})
res = inv_id res = inv_id
return res return res
hr_expense_expense() hr_expense_expense()
class product_product(osv.osv): class product_product(osv.osv):
@ -184,7 +183,7 @@ class hr_expense_line(osv.osv):
_name = "hr.expense.line" _name = "hr.expense.line"
_description = "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): if not len(ids):
return {} 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),)) 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'), 'analytic_account': fields.many2one('account.analytic.account','Analytic account'),
'ref': fields.char('Reference', size=32), 'ref': fields.char('Reference', size=32),
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."), 'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."),
} }
_defaults = { _defaults = {
'unit_quantity': lambda *a: 1, 'unit_quantity': 1,
'date_value' : lambda *a: time.strftime('%Y-%m-%d'), 'date_value': time.strftime('%Y-%m-%d'),
} }
_order = "sequence" _order = "sequence"
def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None): 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: if product_id:
product=self.pool.get('product.product').browse(cr, uid, product_id, context=context) product=self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v['name']=product.name v['name']=product.name
# Compute based on pricetype of employee company # 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 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 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) pricetype=self.pool.get('product.price.type').browse(cr, uid, pricetype_id)
amount_unit=product.price_get(pricetype.field, context)[product.id] amount_unit=product.price_get(pricetype.field, context)[product.id]
v['unit_amount']=amount_unit v['unit_amount']=amount_unit
if not uom_id: if not uom_id:
v['uom_id']=product.uom_id.id v['uom_id']=product.uom_id.id

View File

@ -58,6 +58,7 @@
<field name="uom_id" ref="product.product_uom_unit"/> <field name="uom_id" ref="product.product_uom_unit"/>
<field eval="1.0" name="unit_quantity"/> <field eval="1.0" name="unit_quantity"/>
</record> </record>
<record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line"> <record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line">
<field name="name">Basic PC - Server for Seagate</field> <field name="name">Basic PC - Server for Seagate</field>
<field name="date_value">2010-05-03</field> <field name="date_value">2010-05-03</field>
@ -68,7 +69,9 @@
<field name="uom_id" ref="product.product_uom_unit"/> <field name="uom_id" ref="product.product_uom_unit"/>
<field eval="1.0" name="unit_quantity"/> <field eval="1.0" name="unit_quantity"/>
</record> </record>
</data> </data>
<data noupdate="1"> <data noupdate="1">
<record id="hr_expense_expense_septemberexpenses1" model="hr.expense.expense"> <record id="hr_expense_expense_septemberexpenses1" model="hr.expense.expense">
<field name="currency_id" ref="base.EUR"/> <field name="currency_id" ref="base.EUR"/>
@ -79,6 +82,7 @@
<field name="date">2010-04-20</field> <field name="date">2010-04-20</field>
<field name="state">draft</field> <field name="state">draft</field>
</record> </record>
<record id="hr_expense_line_hotelexpensesthymbra0" model="hr.expense.line"> <record id="hr_expense_line_hotelexpensesthymbra0" model="hr.expense.line">
<field name="name">Hotel Expenses - Thymbra</field> <field name="name">Hotel Expenses - Thymbra</field>
<field name="date_value">2010-05-03</field> <field name="date_value">2010-05-03</field>
@ -89,17 +93,17 @@
<field name="uom_id" ref="product.product_uom_unit"/> <field name="uom_id" ref="product.product_uom_unit"/>
<field eval="5.0" name="unit_quantity"/> <field eval="5.0" name="unit_quantity"/>
</record> </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> </data>
</openerp> </openerp>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
<field name="res_model">hr.holidays</field> <field name="res_model">hr.holidays</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,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"/> <field name="view_id" ref="hr_holidays.open_allocation_holidays"/>
</record> </record>
@ -21,6 +21,7 @@
<field name="domain">[('user_id','=',uid)]</field> <field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="hr_holidays.view_hr_holidays_remaining_leaves_user_graph"/> <field name="view_id" ref="hr_holidays.view_hr_holidays_remaining_leaves_user_graph"/>
</record> </record>
<record id="board_hr_holidays_form" model="ir.ui.view"> <record id="board_hr_holidays_form" model="ir.ui.view">
<field name="name">board.hr.holidays.form</field> <field name="name">board.hr.holidays.form</field>
<field name="model">board.board</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="date_to">2008-01-01 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Easter Monday</field> <field name="name">Easter Monday</field>
<field name="date_from">2008-03-24 08:00</field> <field name="date_from">2008-03-24 08:00</field>
<field name="date_to">2008-03-24 18:00</field> <field name="date_to">2008-03-24 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Labour Day</field> <field name="name">Labour Day</field>
<field name="date_from">2008-05-01 08:00</field> <field name="date_from">2008-05-01 08:00</field>
<field name="date_to">2008-05-01 18:00</field> <field name="date_to">2008-05-01 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Ascension</field> <field name="name">Ascension</field>
<field name="date_from">2008-05-02 08:00</field> <field name="date_from">2008-05-02 08:00</field>
<field name="date_to">2008-05-02 18:00</field> <field name="date_to">2008-05-02 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Pentecost Monday</field> <field name="name">Pentecost Monday</field>
<field name="date_from">2008-05-12 08:00</field> <field name="date_from">2008-05-12 08:00</field>
<field name="date_to">2008-05-12 18:00</field> <field name="date_to">2008-05-12 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">National Day</field> <field name="name">National Day</field>
<field name="date_from">2008-07-21 08:00</field> <field name="date_from">2008-07-21 08:00</field>
<field name="date_to">2008-07-21 18:00</field> <field name="date_to">2008-07-21 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Assumption Day</field> <field name="name">Assumption Day</field>
<field name="date_from">2008-08-15 08:00</field> <field name="date_from">2008-08-15 08:00</field>
<field name="date_to">2008-08-15 18:00</field> <field name="date_to">2008-08-15 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">All Saints</field> <field name="name">All Saints</field>
<field name="date_from">2008-11-01 08:00</field> <field name="date_from">2008-11-01 08:00</field>
<field name="date_to">2008-11-01 18:00</field> <field name="date_to">2008-11-01 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Armistice</field> <field name="name">Armistice</field>
<field name="date_from">2008-11-11 08:00</field> <field name="date_from">2008-11-11 08:00</field>
<field name="date_to">2008-11-11 18:00</field> <field name="date_to">2008-11-11 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
<record model="hr.holidays"> <record model="hr.holidays">
<field name="name">Christmas</field> <field name="name">Christmas</field>
<field name="date_from">2008-12-25 08:00</field> <field name="date_from">2008-12-25 08:00</field>
<field name="date_to">2008-12-25 18:00</field> <field name="date_to">2008-12-25 18:00</field>
<field name="holiday_status" ref="hr.jf" /> <field name="holiday_status" ref="hr.jf" />
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -20,6 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import time import time
import datetime import datetime
@ -69,6 +70,7 @@ class hr_holidays_status(osv.osv):
return_false = False return_false = False
employee_id = False employee_id = False
res = {} res = {}
if context and context.has_key('employee_id'): if context and context.has_key('employee_id'):
if not context['employee_id']: if not context['employee_id']:
return_false = True return_false = True
@ -100,7 +102,7 @@ class hr_holidays_status(osv.osv):
_defaults = { _defaults = {
'color_name': 'red', 'color_name': 'red',
'active': True, 'active': True,
} }
hr_holidays_status() hr_holidays_status()
@ -110,22 +112,22 @@ class hr_holidays(osv.osv):
_order = "type desc, date_from asc" _order = "type desc, date_from asc"
def _employee_get(obj, cr, uid, context=None): 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: if ids:
return ids[0] return ids[0]
return False return False
_columns = { _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\'.\ '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\'.'), 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), '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)]}), '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'), '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'), '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)]}), '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': 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)]}), 'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
'case_id': fields.many2one('crm.meeting', 'Case'), 'case_id': fields.many2one('crm.meeting', 'Case'),
@ -140,13 +142,13 @@ class hr_holidays(osv.osv):
} }
_defaults = { _defaults = {
'employee_id' : _employee_get , 'employee_id': _employee_get ,
'state' : 'draft', 'state': 'draft',
'type': 'remove', 'type': 'remove',
'allocation_type': 'employee', 'allocation_type': 'employee',
'user_id': lambda obj, cr, uid, context: uid, 'user_id': lambda obj, cr, uid, context: uid,
'holiday_type': 'employee' 'holiday_type': 'employee'
} }
def _create_resource_leave(self, cr, uid, vals, context=None): 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 ''' '''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) self.unlink(cr, uid, list_ids)
def _check_date(self, cr, uid, 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: if rec['number_of_days_temp'] < 0:
return False return False
if rec['type']=='add': if rec['type'] == 'add':
continue continue
date_from = time.strptime(rec['date_from'], '%Y-%m-%d %H:%M:%S') 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') 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): def onchange_date_to(self, cr, uid, ids, date_from, date_to):
return self.onchange_date_from(cr, uid, ids, date_to, date_from) 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 = {} warning = {}
if status: if status:
brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status])[0] 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): def set_to_draft(self, cr, uid, ids, *args):
wf_service = netsvc.LocalService("workflow") wf_service = netsvc.LocalService("workflow")
self.write(cr, uid, ids, { self.write(cr, uid, ids, {
'state':'draft', 'state': 'draft',
'manager_id': False, 'manager_id': False,
'number_of_days': 0, 'number_of_days': 0,
}) })
@ -274,7 +276,7 @@ class hr_holidays(osv.osv):
def holidays_validate2(self, cr, uid, ids, *args): def holidays_validate2(self, cr, uid, ids, *args):
vals = {'state':'validate1'} vals = {'state':'validate1'}
self.check_holidays(cr, uid, ids) 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: if ids2:
vals['manager_id'] = ids2[0] vals['manager_id'] = ids2[0]
else: else:
@ -287,17 +289,17 @@ class hr_holidays(osv.osv):
data_holiday = self.browse(cr, uid, ids) data_holiday = self.browse(cr, uid, ids)
self.check_holidays(cr, uid, ids) self.check_holidays(cr, uid, ids)
vals = {'state':'validate'} vals = {'state':'validate'}
ids2 = obj_emp.search(cr, uid, [('user_id','=', uid)]) ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
if ids2: if ids2:
if data_holiday[0].state == 'validate1': if data_holiday[0].state == 'validate1':
vals['manager_id2'] = ids2[0] vals['manager_id2'] = ids2[0]
else: else:
vals['manager_id'] = ids2[0] vals['manager_id'] = ids2[0]
else: 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) self.write(cr, uid, ids, vals)
for record in data_holiday: for record in data_holiday:
if record.holiday_type=='employee' and record.type=='remove': if record.holiday_type == 'employee' and record.type == 'remove':
vals = { vals = {
'name': record.name, 'name': record.name,
'date_from': record.date_from, 'date_from': record.date_from,
@ -308,7 +310,7 @@ class hr_holidays(osv.osv):
'holiday_id': record.id 'holiday_id': record.id
} }
self._create_resource_leave(cr, uid, vals) 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)]) emp_ids = obj_emp.search(cr, uid, [('category_id', '=', record.category_id.id)])
for emp in obj_emp.browse(cr, uid, emp_ids): for emp in obj_emp.browse(cr, uid, emp_ids):
vals = { vals = {
@ -327,13 +329,13 @@ class hr_holidays(osv.osv):
for record in self.browse(cr, uid, ids): for record in self.browse(cr, uid, ids):
user_id = False user_id = False
leave_asked = record.number_of_days_temp 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: 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'] 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: 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))) 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) 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: 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'] 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: if leaves_rest < leave_asked:
@ -342,20 +344,14 @@ class hr_holidays(osv.osv):
else: else:
nb = record.number_of_days_temp 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 user_id = record.employee_id.user_id and record.employee_id.user_id.id or uid
self.write(cr, uid, [record.id], { self.write(cr, uid, [record.id], {'state':'confirm', 'number_of_days': nb, 'user_id': user_id })
'state':'confirm',
'number_of_days': nb,
'user_id': user_id
})
return True return True
def holidays_refuse(self, cr, uid, ids, *args): def holidays_refuse(self, cr, uid, ids, *args):
vals = { vals = {'state': 'refuse'}
'state':'refuse',
}
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: if ids2:
vals['manager_id'] = ids2[0] vals['manager_id'] = ids2[0]
@ -364,22 +360,18 @@ class hr_holidays(osv.osv):
def holidays_cancel(self, cr, uid, ids, *args): def holidays_cancel(self, cr, uid, ids, *args):
self._update_user_holidays(cr, uid, ids) self._update_user_holidays(cr, uid, ids)
self.write(cr, uid, ids, { self.write(cr, uid, ids, {'state': 'cancel'})
'state':'cancel'
})
self._remove_resouce_leave(cr, uid, ids) self._remove_resouce_leave(cr, uid, ids)
return True return True
def holidays_draft(self, cr, uid, ids, *args): def holidays_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, { self.write(cr, uid, ids, {'state': 'draft'})
'state':'draft'
})
return True return True
def check_holidays(self, cr, uid, ids): def check_holidays(self, cr, uid, ids):
for record in self.browse(cr, uid, ids): for record in self.browse(cr, uid, ids):
if not record.number_of_days: 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: if record.holiday_type=='employee' and record.employee_id:
leave_asked = record.number_of_days leave_asked = record.number_of_days
if leave_asked < 0.00: 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'] 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): if leaves_rest < -(leave_asked):
raise osv.except_osv(_('Warning!'),_('You Cannot Validate leaves while available leaves are less than asked leaves.')) 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 leave_asked = record.number_of_days
if leave_asked < 0.00: if leave_asked < 0.00:
if not record.holiday_status_id.limit: 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)]) user_id = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
if user_id: if user_id:
vals['user_id'] = user_id[0] 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_confirm(cr, uid, holiday_ids)
self.holidays_validate(cr, uid, holiday_ids) self.holidays_validate(cr, uid, holiday_ids)
@ -444,7 +436,7 @@ class hr_holidays(osv.osv):
'date' : record.date_from, 'date' : record.date_from,
} }
case_id = self.pool.get('crm.meeting').create(cr, uid, vals) 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 return True
@ -455,8 +447,8 @@ class resource_calendar_leaves(osv.osv):
_description = "Leave Detail" _description = "Leave Detail"
_columns = { _columns = {
'holiday_id': fields.many2one("hr.holidays", "Holiday"), 'holiday_id': fields.many2one("hr.holidays", "Holiday"),
} }
resource_calendar_leaves() 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"?> <?xml version="1.0"?>
<openerp> <openerp>
<data> <data>
<report id="report_holidays_summary" <report id="report_holidays_summary"
string="Summary Of Leaves" string="Summary Of Leaves"
model="hr.holidays" model="hr.holidays"

View File

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

View File

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

View File

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

View File

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

View File

@ -234,8 +234,8 @@ class report_custom(report_rml):
continue continue
dept_done=0 dept_done=0
for d in range(0,len(result)): 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])]) 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']) items = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, emp_id[d], ['id', 'name'])
for item in items: for item in items:
# if item['id'] in done: # if item['id'] in done:
# continue # continue
@ -261,5 +261,6 @@ class report_custom(report_rml):
return xml return xml
report_custom('report.holidays.summary', 'hr.holidays', '', 'addons/hr_holidays/report/holidays_summary.xsl') report_custom('report.holidays.summary', 'hr.holidays', '', 'addons/hr_holidays/report/holidays_summary.xsl')
# 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import tools import tools
from osv import fields,osv from osv import fields,osv
@ -70,8 +71,8 @@ class hr_holidays_report(osv.osv):
s.state s.state
from from
hr_holidays s hr_holidays s
where type='remove' WHERE type='remove'
group by GROUP BY
s.create_date,s.state,s.date_from,s.date_to, s.create_date,s.state,s.date_from,s.date_to,
s.employee_id,s.user_id,s.holiday_status_id, s.employee_id,s.user_id,s.holiday_status_id,
s.department_id, s.category_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'), 'no_of_leaves': fields.integer('Remaining leaves'),
'user_id': fields.many2one('res.users', 'User'), 'user_id': fields.many2one('res.users', 'User'),
'leave_type': fields.char('Leave Type', size=64), 'leave_type': fields.char('Leave Type', size=64),
}
}
def init(self, cr): def init(self, cr):
tools.drop_view_if_exists(cr, 'hr_holidays_remaining_leaves_user') tools.drop_view_if_exists(cr, 'hr_holidays_remaining_leaves_user')
cr.execute(""" cr.execute("""
create or replace view hr_holidays_remaining_leaves_user as ( CREATE or REPLACE view hr_holidays_remaining_leaves_user as (
select SELECT
min(hrs.id) as id, min(hrs.id) as id,
rr.name as name, rr.name as name,
sum(hrs.number_of_days) as no_of_leaves, sum(hrs.number_of_days) as no_of_leaves,
rr.user_id as user_id, rr.user_id as user_id,
hhs.name as leave_type hhs.name as leave_type
from FROM
hr_holidays as hrs, hr_employee as hre, hr_holidays as hrs, hr_employee as hre,
resource_resource as rr,hr_holidays_status as hhs resource_resource as rr,hr_holidays_status as hhs
where WHERE
hrs.employee_id = hre.id and hrs.employee_id = hre.id and
hre.resource_id = rr.id and hre.resource_id = rr.id and
hhs.id = hrs.holiday_status_id hhs.id = hrs.holiday_status_id
group by GROUP BY
rr.name,rr.user_id,hhs.name rr.name,rr.user_id,hhs.name
) )
""") """)

View File

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

View File

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