Availabilities
bzr revid: pinky-3c6c84c410dd6c5ef1c0f2bae137a0b2f75be967
This commit is contained in:
parent
e0cebcd65b
commit
0768f37ab4
|
@ -1,4 +1,36 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
from osv import fields, osv
|
||||
import time
|
||||
|
||||
class hr_employee_marital_status(osv.osv):
|
||||
_name = "hr.employee.marital.status"
|
||||
|
@ -65,7 +97,7 @@ class hr_contract(osv.osv):
|
|||
'notes' : fields.text('Notes'),
|
||||
}
|
||||
_defaults = {
|
||||
'date_start' : lambda *a : DateTime.now().strftime("%Y-%m-%d"),
|
||||
'date_start' : lambda *a : time.strftime("%Y-%m-%d"),
|
||||
'working_hours_per_day' : lambda *a : 8,
|
||||
}
|
||||
hr_contract()
|
||||
|
|
|
@ -1,13 +1,46 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import time
|
||||
|
||||
class hr_employee(osv.osv):
|
||||
_inherit = "hr.employee"
|
||||
def _get_state(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
t = time.strftime('%Y-%m-%d')
|
||||
for emp in self.browse(cr, uid, ids, context):
|
||||
result[emp.id] = 'no'
|
||||
|
||||
for alloc in emp.allocation_ids:
|
||||
if ((not alloc.date_end) or (alloc.date_end>='%Y-%m-%d')) and (alloc.date_start<='%Y-%m-%d'):
|
||||
if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t):
|
||||
result[emp.id] = alloc.state
|
||||
return result
|
||||
def _get_date_end(self, cr, uid, ids, name, args, context):
|
||||
|
@ -19,10 +52,11 @@ class hr_employee(osv.osv):
|
|||
return result
|
||||
def _get_department_id(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
t = time.strftime('%Y-%m-%d')
|
||||
for emp in self.browse(cr, uid, ids, context):
|
||||
result[emp.id] = time.strftime('%Y-%m-%d')
|
||||
result[emp.id] = False
|
||||
for alloc in emp.allocation_ids:
|
||||
if ((not alloc.date_end) or (alloc.date_end>='%Y-%m-%d')) and (alloc.date_start<='%Y-%m-%d'):
|
||||
if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t):
|
||||
result[emp.id] = alloc.department_id.id
|
||||
return result
|
||||
_columns = {
|
||||
|
@ -41,7 +75,7 @@ class hr_allocation(osv.osv):
|
|||
_name = 'hr.allocation'
|
||||
_description = 'Allocations'
|
||||
_columns = {
|
||||
'name' : fields.char('Contract Name', size=30, required=True),
|
||||
'name' : fields.char('Allocation Name', size=30, required=True),
|
||||
'employee_id' : fields.many2one('hr.employee', 'Employee', required=True, relate=True),
|
||||
'department_id' : fields.many2one('res.company', 'Department', required=True, relate=True),
|
||||
'function' : fields.many2one('res.partner.function', 'Function'),
|
||||
|
@ -51,9 +85,9 @@ class hr_allocation(osv.osv):
|
|||
}
|
||||
_order = 'date_start'
|
||||
_defaults = {
|
||||
'date_start' : lambda *a : DateTime.now().strftime("%Y-%m-%d"),
|
||||
'date_start' : lambda *a : time.strftime("%Y-%m-%d"),
|
||||
'state' : lambda *a : 'ondemand',
|
||||
'department_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
|
||||
}
|
||||
hr_contract()
|
||||
hr_allocation()
|
||||
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
<field name="allocation_date_end"/>
|
||||
<field name="allocation_department_id"/>
|
||||
<newline/>
|
||||
<separator string="Allocations"/>
|
||||
<field name="allocation_ids" colspan="4" nolabel="1">
|
||||
<tree string="Contracts">
|
||||
<tree string="Allocations">
|
||||
<field name="department_id"/>
|
||||
<field name="function"/>
|
||||
<field name="date_start"/>
|
||||
|
@ -23,7 +22,7 @@
|
|||
</tree>
|
||||
|
||||
<form string="Allocations">
|
||||
<field name="name"/>
|
||||
<field name="name" colspan="3"/>
|
||||
<field name="department_id"/>
|
||||
<field name="function"/>
|
||||
<field name="date_start"/>
|
||||
|
@ -40,7 +39,7 @@
|
|||
<field name="name">hr.employee.available.tree</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id">hr.view_employee_list</field>
|
||||
<field name="inherit_id" ref="hr.view_employee_list"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="parent_id" position="replace">
|
||||
<field name="allocation_state"/>
|
||||
|
|
Loading…
Reference in New Issue