From 9566dcc2959adcbf09aaec89328f027afd52d6f0 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 19 Jul 2010 15:16:40 +0530 Subject: [PATCH] [IMP] resource/project_long_term: renamed resource.calendar.week object into resource.calendar.attendance bzr revid: qdp-launchpad@tinyerp.com-20100719094640-w08n8337ip7rf7yn --- .../wizard/working_calendar.py | 6 +++--- addons/resource/resource.py | 14 ++++++------- addons/resource/resource_demo.xml | 20 +++++++++---------- addons/resource/resource_view.xml | 12 +++++------ addons/resource/security/ir.model.access.csv | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/addons/project_long_term/wizard/working_calendar.py b/addons/project_long_term/wizard/working_calendar.py index d52bd54b437..1de7e717502 100644 --- a/addons/project_long_term/wizard/working_calendar.py +++ b/addons/project_long_term/wizard/working_calendar.py @@ -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: diff --git a/addons/resource/resource.py b/addons/resource/resource.py index d8eb378b7d8..0aba6b10081 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -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_from0): @@ -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" diff --git a/addons/resource/resource_demo.xml b/addons/resource/resource_demo.xml index b70728ea9ad..2d1b6622e07 100644 --- a/addons/resource/resource_demo.xml +++ b/addons/resource/resource_demo.xml @@ -8,70 +8,70 @@ 38 Hours/Week - + Monday morning 0 08 12 - + Monday evening 0 13 18 - + Tuesday morning 1 08 12 - + Tuesday evening 1 13 18 - + Wednesday morning 2 08 12 - + Wednesday evening 2 13 18 - + Thursday morning 3 08 12 - + Thursday evening 13 18 3 - + Friday morning 4 08 12 - + Friday evening 4 13 diff --git a/addons/resource/resource_view.xml b/addons/resource/resource_view.xml index 49e04abbe53..e1da3c15d7d 100644 --- a/addons/resource/resource_view.xml +++ b/addons/resource/resource_view.xml @@ -106,9 +106,9 @@ - - resource.calendar.week.tree - resource.calendar.week + + resource.calendar.attendance.tree + resource.calendar.attendance tree @@ -119,9 +119,9 @@ - - resource.calendar.week.form - resource.calendar.week + + resource.calendar.attendance.form + resource.calendar.attendance form
diff --git a/addons/resource/security/ir.model.access.csv b/addons/resource/security/ir.model.access.csv index 83e06121937..8d1d231a84b 100644 --- a/addons/resource/security/ir.model.access.csv +++ b/addons/resource/security/ir.model.access.csv @@ -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