[IMP] resource/project_long_term: renamed resource.calendar.week object into resource.calendar.attendance
bzr revid: qdp-launchpad@tinyerp.com-20100719094640-w08n8337ip7rf7yn
This commit is contained in:
@@ -81,7 +81,7 @@ def compute_working_calendar(cr, uid, calendar_id, context=None):
|
||||
"""
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
resource_week_obj = pool.get('resource.calendar.week')
|
||||
resource_attendance_obj = pool.get('resource.calendar.attendance')
|
||||
time_range = "8:00-8:00"
|
||||
non_working = ""
|
||||
week_days = {"0": "mon", "1": "tue", "2": "wed","3": "thu", "4": "fri", "5": "sat", "6": "sun"}
|
||||
@@ -89,8 +89,8 @@ def compute_working_calendar(cr, uid, calendar_id, context=None):
|
||||
wk_time = {}
|
||||
wktime_list = []
|
||||
wktime_cal = []
|
||||
week_ids = resource_week_obj.search(cr, uid, [('calendar_id', '=', calendar_id)], context=context)
|
||||
weeks = resource_week_obj.read(cr, uid, week_ids, ['dayofweek', 'hour_from', 'hour_to'], context=context)
|
||||
week_ids = resource_attendance_obj.search(cr, uid, [('calendar_id', '=', calendar_id)], context=context)
|
||||
weeks = resource_attendance_obj.read(cr, uid, week_ids, ['dayofweek', 'hour_from', 'hour_to'], context=context)
|
||||
# Convert time formats into appropriate format required
|
||||
# and create a list like [('mon', '8:00-12:00'), ('mon', '13:00-18:00')]
|
||||
for week in weeks:
|
||||
|
||||
@@ -31,7 +31,7 @@ class resource_calendar(osv.osv):
|
||||
_columns = {
|
||||
'name' : fields.char("Name", size=64, required=True),
|
||||
'company_id' : fields.many2one('res.company', 'Company', required=False),
|
||||
'week_id' : fields.one2many('resource.calendar.week', 'calendar_id', 'Working Time'),
|
||||
'attendance_ids' : fields.one2many('resource.calendar.attendance', 'calendar_id', 'Working Time'),
|
||||
'manager' : fields.many2one('res.users', 'Workgroup manager'),
|
||||
}
|
||||
_defaults = {
|
||||
@@ -65,7 +65,7 @@ class resource_calendar(osv.osv):
|
||||
maxrecur = 100
|
||||
current_hour = dt_from.hour
|
||||
while (todo>0) and maxrecur:
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_week where dayofweek='%s' and calendar_id=%s order by hour_from desc", (dt_from.day_of_week,id))
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_attendance where dayofweek='%s' and calendar_id=%s order by hour_from desc", (dt_from.day_of_week,id))
|
||||
for (hour_from,hour_to) in cr.fetchall():
|
||||
leave_flag = False
|
||||
if (hour_from<current_hour) and (todo>0):
|
||||
@@ -101,7 +101,7 @@ class resource_calendar(osv.osv):
|
||||
maxrecur = 100
|
||||
current_hour = dt_from.hour
|
||||
while (todo>0) and maxrecur:
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_week where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id))
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_attendance where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id))
|
||||
for (hour_from,hour_to) in cr.fetchall():
|
||||
leave_flag = False
|
||||
if (hour_to>current_hour) and (todo>0):
|
||||
@@ -136,7 +136,7 @@ class resource_calendar(osv.osv):
|
||||
current_hour = dt_from.hour
|
||||
|
||||
while (dt_from <= dt_to):
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_week where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id))
|
||||
cr.execute("select hour_from,hour_to from resource_calendar_attendance where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id))
|
||||
der = cr.fetchall()
|
||||
for (hour_from,hour_to) in der:
|
||||
if hours != 0.0:#For first time of the loop only,hours will be 0
|
||||
@@ -169,8 +169,8 @@ class resource_calendar(osv.osv):
|
||||
|
||||
resource_calendar()
|
||||
|
||||
class resource_calendar_week(osv.osv):
|
||||
_name = "resource.calendar.week"
|
||||
class resource_calendar_attendance(osv.osv):
|
||||
_name = "resource.calendar.attendance"
|
||||
_description = "Work Detail"
|
||||
_columns = {
|
||||
'name' : fields.char("Name", size=64, required=True),
|
||||
@@ -181,7 +181,7 @@ class resource_calendar_week(osv.osv):
|
||||
'calendar_id' : fields.many2one("resource.calendar", "Resource's Calendar", required=True),
|
||||
}
|
||||
_order = 'dayofweek, hour_from'
|
||||
resource_calendar_week()
|
||||
resource_calendar_attendance()
|
||||
|
||||
class resource_resource(osv.osv):
|
||||
_name = "resource.resource"
|
||||
|
||||
@@ -8,70 +8,70 @@
|
||||
<field name="name">38 Hours/Week</field>
|
||||
</record>
|
||||
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Monday morning</field>
|
||||
<field name="dayofweek">0</field>
|
||||
<field name="hour_from">08</field>
|
||||
<field name="hour_to">12</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Monday evening</field>
|
||||
<field name="dayofweek">0</field>
|
||||
<field name="hour_from">13</field>
|
||||
<field name="hour_to">18</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Tuesday morning</field>
|
||||
<field name="dayofweek">1</field>
|
||||
<field name="hour_from">08</field>
|
||||
<field name="hour_to">12</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Tuesday evening</field>
|
||||
<field name="dayofweek">1</field>
|
||||
<field name="hour_from">13</field>
|
||||
<field name="hour_to">18</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Wednesday morning</field>
|
||||
<field name="dayofweek">2</field>
|
||||
<field name="hour_from">08</field>
|
||||
<field name="hour_to">12</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Wednesday evening</field>
|
||||
<field name="dayofweek">2</field>
|
||||
<field name="hour_from">13</field>
|
||||
<field name="hour_to">18</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Thursday morning</field>
|
||||
<field name="dayofweek">3</field>
|
||||
<field name="hour_from">08</field>
|
||||
<field name="hour_to">12</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Thursday evening</field>
|
||||
<field name="hour_from">13</field>
|
||||
<field name="hour_to">18</field>
|
||||
<field name="dayofweek">3</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Friday morning</field>
|
||||
<field name="dayofweek">4</field>
|
||||
<field name="hour_from">08</field>
|
||||
<field name="hour_to">12</field>
|
||||
<field name="calendar_id" ref="timesheet_group1"/>
|
||||
</record>
|
||||
<record model="resource.calendar.week">
|
||||
<record model="resource.calendar.attendance">
|
||||
<field name="name">Friday evening</field>
|
||||
<field name="dayofweek">4</field>
|
||||
<field name="hour_from">13</field>
|
||||
|
||||
@@ -106,9 +106,9 @@
|
||||
<field name="search_view_id" ref="view_resource_calendar_search"/>
|
||||
</record>
|
||||
|
||||
<record id="view_resource_calendar_week_tree" model="ir.ui.view">
|
||||
<field name="name">resource.calendar.week.tree</field>
|
||||
<field name="model">resource.calendar.week</field>
|
||||
<record id="view_resource_calendar_attendance_tree" model="ir.ui.view">
|
||||
<field name="name">resource.calendar.attendance.tree</field>
|
||||
<field name="model">resource.calendar.attendance</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Working Time">
|
||||
@@ -119,9 +119,9 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_resource_calendar_week_form" model="ir.ui.view">
|
||||
<field name="name">resource.calendar.week.form</field>
|
||||
<field name="model">resource.calendar.week</field>
|
||||
<record id="view_resource_calendar_attendance_form" model="ir.ui.view">
|
||||
<field name="name">resource.calendar.attendance.form</field>
|
||||
<field name="model">resource.calendar.attendance</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Working Time">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_resource_calendar","resource.calendar","model_resource_calendar","base.group_system",1,1,1,1
|
||||
"access_resource_calendar_week","resource.calendar.week","model_resource_calendar_week","base.group_system",1,1,1,1
|
||||
"access_resource_calendar_attendance","resource.calendar.attendance","model_resource_calendar_attendance","base.group_system",1,1,1,1
|
||||
"access_resource_resource","resource.resource","model_resource_resource","base.group_system",1,1,1,1
|
||||
"access_resource_resource_all","resource.resource all","model_resource_resource",,1,0,0,0
|
||||
"access_resource_calendar_leaves","resource.calendar.leaves","model_resource_calendar_leaves","base.group_system",1,1,1,1
|
||||
|
||||
|
Reference in New Issue
Block a user