From 622e39465b006df40574f02cf70d9e7008d10ac7 Mon Sep 17 00:00:00 2001
From: "Vianney,Anup(OpenERP)" <>
Date: Wed, 6 Oct 2010 16:42:47 +0530
Subject: [PATCH 1/9] [FIX] project_long_term : _compute() method corrected and
view of project phase corrected.
lp bug: https://launchpad.net/bugs/655316 fixed
bzr revid: ach@tinyerp.com-20101006111247-53h19u0qw8z97u4u
---
addons/project_long_term/project_long_term.py | 6 ++---
.../project_long_term_view.xml | 25 ++++++++++---------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 2caf36766b0..0c31c485753 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -92,7 +92,7 @@ class project_phase(osv.osv):
model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour')
return model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
- def _compute(self, cr, uid, ids, context=None):
+ def _compute(self, cr, uid, ids,field_name, arg, context=None):
res = {}
if not ids:
return res
@@ -100,9 +100,7 @@ class project_phase(osv.osv):
tot = 0.0
for task in phase.task_ids:
tot += task.planned_hours
- res[phase.id] = {
- 'total_hours' : tot
- }
+ res[phase.id] = tot
return res
_columns = {
diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml
index 3412ba7ca08..fa645af4127 100644
--- a/addons/project_long_term/project_long_term_view.xml
+++ b/addons/project_long_term/project_long_term_view.xml
@@ -110,22 +110,23 @@
form
-
+
-
+
Make Invoices
ir.actions.act_window
sale.order.line.make.invoice
@@ -34,4 +34,4 @@
sale.order.line
-
\ No newline at end of file
+
diff --git a/addons/thunderbird/thunderbird_installer.xml b/addons/thunderbird/thunderbird_installer.xml
index 0c8b431a82f..0059cdfd8ab 100644
--- a/addons/thunderbird/thunderbird_installer.xml
+++ b/addons/thunderbird/thunderbird_installer.xml
@@ -60,8 +60,9 @@
-
- 3
+
+ always
+ 3
From 834f85ab4ff6837901f8b4a811c2d073388cb8b9 Mon Sep 17 00:00:00 2001
From: "qdp-launchpad@tinyerp.com" <>
Date: Wed, 6 Oct 2010 18:39:01 +0200
Subject: [PATCH 6/9] [IMP] hr_timesheet_sheet: set the timesheet sheet working
per employee instead of per user
bzr revid: qdp-launchpad@tinyerp.com-20101006163901-7x4wz3abc3a1qqbm
---
.../hr_timesheet_sheet/hr_timesheet_sheet.py | 35 +++++++++++-----
.../hr_timesheet_sheet_view.xml | 40 +++++--------------
.../report/timesheet_report_view.xml | 6 +--
3 files changed, 39 insertions(+), 42 deletions(-)
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 55e25e4001c..ce074715888 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -178,6 +178,21 @@ class hr_timesheet_sheet(osv.osv):
def copy(self, cr, uid, ids, *args, **argv):
raise osv.except_osv(_('Error !'), _('You cannot duplicate a timesheet !'))
+ def create(self, cr, uid, vals, *args, **argv):
+ if 'employee_id' in vals:
+ if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id:
+ raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any user defined !'))
+ return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv)
+
+ def write(self, cr, uid, ids, vals, *args, **argv):
+ if 'employee_id' in vals:
+ new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False
+ if not new_user_id:
+ raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any user defined !'))
+ if not self._sheet_date(cr, uid, ids, forced_user_id=new_user_id):
+ raise osv.except_osv(_('Error !'), _('You can not have 2 timesheets that overlaps !\nPlease use the menu \'My Current Timesheet\' to avoid this problem.'))
+ return super(hr_timesheet_sheet, self).write(cr, uid, ids, vals, *args, **argv)
+
def button_confirm(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -262,8 +277,8 @@ class hr_timesheet_sheet(osv.osv):
_columns = {
'name': fields.char('Description', size=64, select=1,
states={'confirm':[('readonly', True)], 'done':[('readonly', True)]}),
- 'user_id': fields.many2one('res.users', 'User', required=True, select=1,
- states={'confirm':[('readonly', True)], 'done':[('readonly', True)]}),
+ 'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
+ 'user_id': fields.related('employee_id', 'user_id', type="many2one", relation="res.users", store=True, string="User", required=False, readonly=True),#fields.many2one('res.users', 'User', required=True, select=1, states={'confirm':[('readonly', True)], 'done':[('readonly', True)]}),
'date_from': fields.date('Date from', required=True, select=1, readonly=True, states={'new':[('readonly', False)]}),
'date_to': fields.date('Date to', required=True, select=1, readonly=True, states={'new':[('readonly', False)]}),
'date_current': fields.date('Current date', required=True),
@@ -320,24 +335,24 @@ class hr_timesheet_sheet(osv.osv):
return time.strftime('%Y-%m-%d')
_defaults = {
- 'user_id': lambda self,cr,uid,c: uid,
'date_from' : _default_date_from,
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
'date_to' : _default_date_to,
'state': 'new',
- 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
}
- def _sheet_date(self, cr, uid, ids):
+ def _sheet_date(self, cr, uid, ids, forced_user_id=False):
for sheet in self.browse(cr, uid, ids):
- cr.execute('SELECT id \
+ new_user_id = forced_user_id or sheet.user_id and sheet.user_id.id
+ if new_user_id:
+ cr.execute('SELECT id \
FROM hr_timesheet_sheet_sheet \
WHERE (date_from < %s and %s < date_to) \
AND user_id=%s \
- AND id <> %s', (sheet.date_to, sheet.date_from,
- sheet.user_id.id, sheet.id))
- if cr.fetchall():
- return False
+ AND id <> %s',(sheet.date_to, sheet.date_from, new_user_id, sheet.id))
+ if cr.fetchall():
+ return False
return True
def _date_current_check(self, cr, uid, ids):
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
index decf3b16b6b..231aba040e7 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
@@ -1,25 +1,6 @@
-
- hr.timesheet.sheet.tree
- hr_timesheet_sheet.sheet
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
hr.timesheet.sheet.graph
hr_timesheet_sheet.sheet
@@ -71,7 +52,7 @@
-
+
@@ -167,7 +148,7 @@
-
+
-
+
@@ -190,7 +171,7 @@
hr_timesheet_sheet.sheet
form
- {'search_default_my_timesheet':1, 'search_default_user_id':uid }
+ {'search_default_my_timesheet':1, }
Employees can encode their time spent on the different projects. A project is an analytic account and the time spent on a project generate costs on the analytic account.
@@ -312,18 +293,19 @@
src_model="hr_timesheet_sheet.sheet"/>
- hr.timesheet.sheet.tree.simplified
+ hr.timesheet.sheet.tree
hr_timesheet_sheet.sheet
tree
-
+
+
-
-
-
-
+
+
+
+
diff --git a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
index 08abc6db63b..a015ff933d2 100644
--- a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
+++ b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
@@ -34,11 +34,11 @@
+
+
+
-
-
-
From 417c87c92886c45e52c7c6f093fb17871bde13cd Mon Sep 17 00:00:00 2001
From: "Jay (OpenERP)"
Date: Wed, 6 Oct 2010 23:08:26 +0530
Subject: [PATCH 7/9] [FIX/REF] Account : Context handling corrected,cleaning
lp bug: https://launchpad.net/bugs/655793 fixed
bzr revid: jvo@tinyerp.com-20101006173826-seoi9hkd52kx5rg6
---
addons/account/account.py | 44 +++++++++++++++++++++------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/addons/account/account.py b/addons/account/account.py
index 208bf1d6f68..3dc5c36c889 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -1162,32 +1162,36 @@ class account_move(osv.osv):
]
def post(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
invoice = context.get('invoice', False)
valid_moves = self.validate(cr, uid, ids, context)
- if valid_moves:
- for move in self.browse(cr, uid, valid_moves):
- if move.name =='/':
- new_name = False
- journal = move.journal_id
+
+ if not valid_moves:
+ raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !'))
+
+ for move in self.browse(cr, uid, valid_moves):
+ if move.name =='/':
+ new_name = False
+ journal = move.journal_id
- if invoice and invoice.internal_number:
- new_name = invoice.internal_number
+ if invoice and invoice.internal_number:
+ new_name = invoice.internal_number
+ else:
+ if journal.sequence_id:
+ c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
+ new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c)
else:
- if journal.sequence_id:
- c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
- new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c)
- else:
- raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
+ raise osv.except_osv(_('Error'), _('No sequence defined on the journal !'))
- if new_name:
- self.write(cr, uid, [move.id], {'name':new_name})
+ if new_name:
+ self.write(cr, uid, [move.id], {'name':new_name})
- cr.execute('UPDATE account_move '\
- 'SET state=%s '\
- 'WHERE id IN %s',
- ('posted', tuple(valid_moves),))
- else:
- raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !'))
+ cr.execute('UPDATE account_move '\
+ 'SET state=%s '\
+ 'WHERE id IN %s',
+ ('posted', tuple(valid_moves),))
+
return True
def button_validate(self, cursor, user, ids, context=None):
From 48c6af52fe18837b21f325c620e1726cabcb8b03 Mon Sep 17 00:00:00 2001
From: "Jay (OpenERP)"
Date: Thu, 7 Oct 2010 00:23:16 +0530
Subject: [PATCH 8/9] [FIX] Regression fixed by a commit 4240 which made
employee_id field mandatory
bzr revid: jvo@tinyerp.com-20101006185316-d1u5tjc2ng01hb0t
---
addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml | 1 +
addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml | 1 +
2 files changed, 2 insertions(+)
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
index b22a88c5036..dedac8377a7 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
@@ -4,6 +4,7 @@
Sheet 0
+
diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
index bb5752d6c9e..808045eb677 100644
--- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
+++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
@@ -70,6 +70,7 @@
name: Week-22(2010)
state: new
user_id: base.user_root
+ employee_id: 'hr_employee_employee0'
-
Now , at the time of login, I create Attendances and perform "Sign In" action.
-
From 209c2f59c88aaf9271a9834c7e1e31f6b83bd102 Mon Sep 17 00:00:00 2001
From: "Jay (OpenERP)"
Date: Thu, 7 Oct 2010 00:49:21 +0530
Subject: [PATCH 9/9] [FIX] hr_attendance : Bad reference of datetime library
corrected
lp bug: https://launchpad.net/bugs/654931 fixed
bzr revid: jvo@tinyerp.com-20101006191921-mddqb2va4spzdo2x
---
addons/hr_attendance/report/timesheet.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py
index 1465be81bc8..096de11664e 100644
--- a/addons/hr_attendance/report/timesheet.py
+++ b/addons/hr_attendance/report/timesheet.py
@@ -41,8 +41,8 @@ class report_custom(report_rml):
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 - relativedelta(days=start_date.day_of_week)
- last_monday = end_date + relativedelta(days=7 - end_date.day_of_week)
+ first_monday = start_date - relativedelta(days=start_date.date().weekday())
+ last_monday = end_date + relativedelta(days=7 - end_date.date().weekday())
if last_monday < first_monday:
first_monday, last_monday = last_monday, first_monday
@@ -82,7 +82,7 @@ class report_custom(report_rml):
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
+ week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + (dt - ldt).hours
ldt = dt
# Week xml representation