diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py
index 2370c6dbe13..a1798ae9cbf 100644
--- a/addons/account/wizard/account_automatic_reconcile.py
+++ b/addons/account/wizard/account_automatic_reconcile.py
@@ -134,7 +134,6 @@ class account_automatic_reconcile(osv.osv_memory):
return (reconciled, len(credits)+len(debits))
def reconcile(self, cr, uid, ids, context=None):
- service = netsvc.LocalService("object_proxy")
move_line_obj = self.pool.get('account.move.line')
obj_model = self.pool.get('ir.model.data')
if context is None:
@@ -240,4 +239,4 @@ class account_automatic_reconcile(osv.osv_memory):
account_automatic_reconcile()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_budget/wizard/account_budget_spread.py b/addons/account_budget/wizard/account_budget_spread.py
index ab2eb3d0bf6..f8a627ce070 100644
--- a/addons/account_budget/wizard/account_budget_spread.py
+++ b/addons/account_budget/wizard/account_budget_spread.py
@@ -32,13 +32,12 @@ class account_budget_spread(osv.osv_memory):
}
def check_spread(self, cr, uid, ids, context=None):
- service = netsvc.LocalService("object_proxy")
if context is None:
context = {}
- data = self.read(cr, uid, ids, [])[0]
- res = service.execute(cr.dbname, uid, 'account.budget.post', 'spread', context['active_ids'], data['fiscalyear'], data['amount'])
+ data = self.browse(cr, uid, ids, context=context)[0]
+ res = self.pool.get('account.budget.post').spread(cr, uid, context['active_ids'], data.fiscalyear.id, data.amount)
return {}
account_budget_spread()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/report/auction_invoice.py b/addons/auction/report/auction_invoice.py
index f367d8df88e..b8c508237a5 100644
--- a/addons/auction/report/auction_invoice.py
+++ b/addons/auction/report/auction_invoice.py
@@ -27,8 +27,7 @@ class auction_invoice(report_int):
report_int.__init__(self, name)
def create(self,cr, uid, ids, datas, context):
- service = netsvc.LocalService("object_proxy")
- lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['ach_inv_id'])
+ lots = self.pool.get('auction.lots').read(cr,uid, ids, ['ach_inv_id'], context=context)
invoices = {}
for l in lots:
diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml
index 597d06faf7d..f1f5eb4a490 100644
--- a/addons/crm/report/crm_phonecall_report_view.xml
+++ b/addons/crm/report/crm_phonecall_report_view.xml
@@ -187,7 +187,7 @@
-
diff --git a/addons/hr/security/ir.model.access.csv b/addons/hr/security/ir.model.access.csv
index 95fca268763..3d05e4d8f04 100644
--- a/addons/hr/security/ir.model.access.csv
+++ b/addons/hr/security/ir.model.access.csv
@@ -1,6 +1,7 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_employee_category","hr.employee.category","model_hr_employee_category","hr.group_hr_user",1,0,0,0
"access_hr_employee","hr.employee","model_hr_employee","hr.group_hr_user",1,1,1,1
+"access_hr_employee_resource","resource.resource","resource.model_resource_resource","hr.group_hr_user",1,1,1,1
"access_hr_department","hr.department","model_hr_department","hr.group_hr_user",1,0,0,0
"access_hr_employee_category_manager","hr.employee.category.manager","model_hr_employee_category","hr.group_hr_manager",1,1,1,1
"access_hr_department_manager","hr.department.manager","model_hr_department","hr.group_hr_manager",1,1,1,1
diff --git a/addons/hr_attendance/report/bymonth.py b/addons/hr_attendance/report/bymonth.py
index 8f9b0eae59e..e30d4107171 100644
--- a/addons/hr_attendance/report/bymonth.py
+++ b/addons/hr_attendance/report/bymonth.py
@@ -39,14 +39,10 @@ def hour2str(h):
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context):
- service = netsvc.LocalService('object_proxy')
-
month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1)
-
user_xml = ['%s' % month2name[month.month], '%s' % month.year]
-
for employee_id in ids:
- emp = service.execute(cr.dbname, uid, 'hr.employee', 'read', [employee_id])[0]
+ emp = self.pool.get('hr.employee').read(cr, uid, 'read', [employee_id], ['name'])[0]
stop, days_xml = False, []
user_repr = '''
diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py
index f5af46d8c43..9b428a6b54f 100644
--- a/addons/hr_attendance/report/timesheet.py
+++ b/addons/hr_attendance/report/timesheet.py
@@ -32,81 +32,80 @@ one_week = DateTime.RelativeDateTime(days=7)
num2day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
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):
- def create_xml(self, cr, uid, ids, datas, context):
- service = netsvc.LocalService('object_proxy')
+ def create_xml(self, cr, uid, ids, datas, context):
- start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d')
- end_date = DateTime.strptime(datas['form']['end_date'], '%Y-%m-%d')
- first_monday = start_date - DateTime.RelativeDateTime(days=start_date.day_of_week)
- last_monday = end_date + DateTime.RelativeDateTime(days=7 - end_date.day_of_week)
+ start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d')
+ end_date = DateTime.strptime(datas['form']['end_date'], '%Y-%m-%d')
+ first_monday = start_date - DateTime.RelativeDateTime(days=start_date.day_of_week)
+ last_monday = end_date + DateTime.RelativeDateTime(days=7 - end_date.day_of_week)
- if last_monday < first_monday:
- first_monday, last_monday = last_monday, first_monday
+ if last_monday < first_monday:
+ first_monday, last_monday = last_monday, first_monday
- user_xml = []
+ user_xml = []
- for employee_id in ids:
- emp = service.execute(cr.dbname, uid, 'hr.employee', 'read', [employee_id], ['id', 'name'])[0]
- monday, n_monday = first_monday, first_monday + one_week
- stop, week_xml = False, []
- user_repr = '''
-
- %s
- %%s
-
- ''' % toxml(emp['name'])
- while monday != last_monday:
- #### Work hour calculation
- sql = '''
- select action, att.name
- from hr_employee as emp inner join hr_attendance as att
- on emp.id = att.employee_id
- where att.name between %s and %s and emp.id = %s
- order by att.name
- '''
- for idx in range(7):
- cr.execute(sql, (monday.strftime('%Y-%m-%d %H:%M:%S'), (monday + DateTime.RelativeDateTime(days=idx+1)).strftime('%Y-%m-%d %H:%M:%S'), employee_id))
- attendances = cr.dictfetchall()
- week_wh = {}
- # Fake sign ins/outs at week ends, to take attendances across week ends into account
- # XXX this is wrong for the first sign-in ever and the last sign out to this date
- if attendances and attendances[0]['action'] == 'sign_out':
- attendances.insert(0, {'name': monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
- if attendances and attendances[-1]['action'] == 'sign_in':
- attendances.append({'name' : n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
- # sum up the attendances' durations
- for att in attendances:
- dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
- if att['action'] == 'sign_out':
- week_wh[ldt.day_of_week] = week_wh.get(ldt.day_of_week, 0) + (dt - ldt).hours
- ldt = dt
+ for employee_id in ids:
+ emp = self.pool.get('hr.employee').read(cr, uid, [employee_id], ['id', 'name'])[0]
+ monday, n_monday = first_monday, first_monday + one_week
+ stop, week_xml = False, []
+ user_repr = '''
+
+ %s
+ %%s
+
+ ''' % toxml(emp['name'])
+ while monday != last_monday:
+ #### Work hour calculation
+ sql = '''
+ select action, att.name
+ from hr_employee as emp inner join hr_attendance as att
+ on emp.id = att.employee_id
+ where att.name between %s and %s and emp.id = %s
+ order by att.name
+ '''
+ for idx in range(7):
+ cr.execute(sql, (monday.strftime('%Y-%m-%d %H:%M:%S'), (monday + DateTime.RelativeDateTime(days=idx+1)).strftime('%Y-%m-%d %H:%M:%S'), employee_id))
+ attendances = cr.dictfetchall()
+ week_wh = {}
+ # Fake sign ins/outs at week ends, to take attendances across week ends into account
+ # XXX this is wrong for the first sign-in ever and the last sign out to this date
+ if attendances and attendances[0]['action'] == 'sign_out':
+ attendances.insert(0, {'name': monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
+ if attendances and attendances[-1]['action'] == 'sign_in':
+ attendances.append({'name' : n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
+ # sum up the attendances' durations
+ for att in attendances:
+ dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
+ if att['action'] == 'sign_out':
+ week_wh[ldt.day_of_week] = week_wh.get(ldt.day_of_week, 0) + (dt - ldt).hours
+ ldt = dt
- # Week xml representation
- week_repr = ['', '%s' % monday.strftime('%Y-%m-%d'), '%s' % n_monday.strftime('%Y-%m-%d')]
- for idx in range(7):
- week_repr.append('<%s>' % num2day[idx])
- if idx in week_wh:
- week_repr.append('%sh%02d' % to_hour(week_wh[idx]))
- week_repr.append('%s>' % num2day[idx])
- week_repr.append('')
- week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, week_wh.values(), 0)))
- week_repr.append('')
- week_repr.append('')
- if len(week_repr) > 21: # 21 = minimal length of week_repr
- week_xml.append('\n'.join(week_repr))
-
- monday, n_monday = n_monday, n_monday + one_week
- user_xml.append(user_repr % '\n'.join(week_xml))
-
- xml = '''
-
- %s
-
- ''' % '\n'.join(user_xml)
- return self.post_process_xml_data(cr, uid, xml, context)
+ # Week xml representation
+ week_repr = ['', '%s' % monday.strftime('%Y-%m-%d'), '%s' % n_monday.strftime('%Y-%m-%d')]
+ for idx in range(7):
+ week_repr.append('<%s>' % num2day[idx])
+ if idx in week_wh:
+ week_repr.append('%sh%02d' % to_hour(week_wh[idx]))
+ week_repr.append('%s>' % num2day[idx])
+ week_repr.append('')
+ week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, week_wh.values(), 0)))
+ week_repr.append('')
+ week_repr.append('')
+ if len(week_repr) > 21: # 21 = minimal length of week_repr
+ week_xml.append('\n'.join(week_repr))
+
+ monday, n_monday = n_monday, n_monday + one_week
+ user_xml.append(user_repr % '\n'.join(week_xml))
+
+ xml = '''
+
+ %s
+
+ ''' % '\n'.join(user_xml)
+ return self.post_process_xml_data(cr, uid, xml, context)
report_custom('report.hr.attendance.allweeks', 'hr.employee', '', 'addons/hr_attendance/report/timesheet.xsl')
# vim:noexpandtab:tw=0
diff --git a/addons/hr_attendance/security/ir.model.access.csv b/addons/hr_attendance/security/ir.model.access.csv
index 6150427e520..54a15a7cc6e 100644
--- a/addons/hr_attendance/security/ir.model.access.csv
+++ b/addons/hr_attendance/security/ir.model.access.csv
@@ -3,3 +3,5 @@
"access_hr_action_reason_employee","hr action reason employee","model_hr_action_reason","hr.group_hr_manager",1,1,1,1
"access_hr_attendance_employee","hr attendance employee","model_hr_attendance","hr_attendance.group_hr_attendance",1,1,1,1
"access_hr_sign_in_out","hr attendance sign in out","model_hr_sign_in_out","hr_attendance.group_hr_attendance",1,1,1,1
+"access_hr_attendance_employee","hr employee attendance sign in out","hr.model_hr_employee","hr_attendance.group_hr_attendance",1,0,0,0
+"access_hr_attendance_resource","hr resource attendance sign in out","resource.model_resource_resource","hr_attendance.group_hr_attendance",1,0,0,0
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
index 9ad27298159..aaaefc088a6 100644
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
+++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
@@ -33,16 +33,14 @@ class hr_si_so_ask(osv.osv_memory):
'emp_id': fields.char('Empoyee ID', size=32, required=True, readonly=True),
}
def _get_empname(self, cr, uid, context=None):
- service = netsvc.LocalService('object_proxy')
- emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
+ emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
- employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0]
+ employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0].name
return employee['name']
return ''
def _get_empid(self, cr, uid, context=None):
- service = netsvc.LocalService('object_proxy')
- emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
+ emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
return emp_id[0]
return False
@@ -74,11 +72,10 @@ class hr_sign_in_out(osv.osv_memory):
}
def _get_empid(self, cr, uid, context=None):
- service = netsvc.LocalService('object_proxy')
- emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
+ emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
- employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0]
- return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}
+ employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
+ return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0]}
return {}
def default_get(self, cr, uid, fields_list, context=None):
@@ -88,15 +85,15 @@ class hr_sign_in_out(osv.osv_memory):
return res
def si_check(self, cr, uid, ids, context=None):
- service = netsvc.LocalService('object_proxy')
obj_model = self.pool.get('ir.model.data')
+ att_obj = self.pool.get('hr.attendance')
data = self.read(cr, uid, ids, [])[0]
emp_id = data['emp_id']
- att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id)], limit=1, order='name desc')
- last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id)
+ att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc')
+ last_att = att_obj.browse(cr, uid, att_id)
if last_att:
last_att = last_att[0]
- cond = not last_att or last_att['action'] == 'sign_out'
+ cond = not last_att or last_att.action == 'sign_out'
if cond:
return self.sign_in(cr, uid, data, context)
else:
@@ -113,12 +110,12 @@ class hr_sign_in_out(osv.osv_memory):
}
def so_check(self, cr, uid, ids, context=None):
- service = netsvc.LocalService('object_proxy')
obj_model = self.pool.get('ir.model.data')
data = self.read(cr, uid, ids, [])[0]
+ att_obj = self.pool.get('hr.attendance')
emp_id = data['emp_id']
- att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc')
- last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id)
+ att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc')
+ last_att = att_obj.browse(cr, uid, att_id, context=context)
if last_att:
last_att = last_att[0]
if not att_id and not last_att:
@@ -151,35 +148,33 @@ class hr_sign_in_out(osv.osv_memory):
}
def sign_in(self, cr, uid, data, context=None):
- service = netsvc.LocalService('object_proxy')
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past'))
- service.execute(cr.dbname, uid, 'hr.attendance', 'create', {
+ self.pool.get('hr.attendance').create(cr, uid, {
'name': data['last_time'],
'action': 'sign_out',
'employee_id': emp_id
})
try:
- success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_in')
+ success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
except:
raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !'))
return {} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None):
- service = netsvc.LocalService('object_proxy')
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past'))
- service.execute(cr.dbname, uid, 'hr.attendance', 'create', {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id})
+ self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id})
try:
- success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_out')
+ success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
except:
raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !'))
return {} # To do: Return Success message
hr_sign_in_out()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml b/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
index d5253dffa25..443983dffe7 100644
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
+++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
@@ -1,21 +1,21 @@
-
+
hr.sign.in.out.form
hr.sign.in.out
form
@@ -27,15 +27,15 @@
form
-
+
Sign in / Sign out
hr.sign.in.out
form
@@ -45,8 +45,8 @@
+ id="menu_hr_attendance_sigh_in_out"
+ parent="menu_hr_time_tracking"/>
hr.sign.in.out.ask.form
@@ -54,14 +54,14 @@
form
@@ -73,14 +73,14 @@
form
diff --git a/addons/hr_contract/security/ir.model.access.csv b/addons/hr_contract/security/ir.model.access.csv
index ab6179c530f..5237b6c01d4 100644
--- a/addons/hr_contract/security/ir.model.access.csv
+++ b/addons/hr_contract/security/ir.model.access.csv
@@ -8,5 +8,8 @@
"access_hr_contract_user","hr.contract user","model_hr_contract","hr.group_hr_user",1,0,0,0
"access_hr_contract","hr.contract","model_hr_contract","group_hr_contract",1,1,1,1
"access_hr_employee_contract","hr.employee contract","hr.model_hr_employee","group_hr_contract",1,0,0,0
+"access_hr_resource_contract","hr.employee.resource contract","resource.model_resource_resource","group_hr_contract",1,0,0,0
+"access_hr_resource_calendar_contract","hr.employee.resource.calendar contract","resource.model_resource_calendar","group_hr_contract",1,0,0,0
+"access_hr_job_contract","hr.employee.job contract","hr.model_hr_job","group_hr_contract",1,0,0,0
"access_hr_contract_type_user","hr.contract.type user","model_hr_contract_type","hr.group_hr_user",1,0,0,0
"access_hr_contract_type","hr.contract.type","model_hr_contract_type","group_hr_contract",1,1,1,1
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 6aad379efcb..936a207caa3 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -41,7 +41,7 @@
id="menu_mrp_configuration"
name="Configuration"
parent="base.menu_mrp_root"
- groups="base.group_extended"
+ groups="group_mrp_manager"
sequence="50" />