Merge lp:~openerp-dev/openobject-addons/7.0-opw-592632-dhr into lp:openobject-addons/7.0

Proposed by Dharti Ratani(OpenERP)
Status: Rejected
Rejected by: Martin Trigaux (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-592632-dhr
Merge into: lp:openobject-addons/7.0
Diff against target: 35 lines (+18/-0)
1 file modified
hr_timesheet_sheet/hr_timesheet_sheet.py (+18/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-592632-dhr
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Disapprove
Naresh(OpenERP) (community) Needs Fixing
Yannick Vaucher @ Camptocamp (community) Needs Fixing
Review via email: mp+164858@code.launchpad.net

Description of the change

Hello Sir,

Made the Sign In - Sign Out button invisible for waiting approval and approved timesheets so that attendances can't be added on waiting approval and approved timesheets.

Thanks
dhr

To post a comment you must log in.
9144. By Dharti Ratani(OpenERP)

[IMP]Removed extra indentation

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

This patch only addresses the view buttons on hr_timesheet.sheet

There is also the sign in wigdet that would generate the same issue.

I think it would be more efficient to solve this in python than only in views.

Thanks

review: Needs Fixing
9145. By Dharti Ratani(OpenERP)

[IMP]Added restriction for creating attendance from py if timesheet for an employee is in waiting approval or approved state

9146. By Dharti Ratani(OpenERP)

[IMP]Checked that current timesheet is closed or not

9147. By Dharti Ratani(OpenERP)

[IMP]Removed extra '|' in attrs

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello Dharti,

I am still able to sign / sign out in an approved / waiting approval timesheets. can you please retest the fix. ?

second there are extra '|' o'ring(pipe) in the attrs domain.

Please update this too.

Thanks,
Naresh Soni
OpenERP Enterprise Services

review: Needs Fixing
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

This merge proposal will work only on the onchange from the attendance form, not form other menu. If you use the form view of hr.attendance, there will have no verification. Same if you use python code or another module creating attendances.
As said Yannick, it would be better to check on the creation of hr.attendance.

I have created a branch doing so
lp:~openerp-dev/openobject-addons/7.0-timesheet-attendance-submit-mat

review: Disapprove

Unmerged revisions

9147. By Dharti Ratani(OpenERP)

[IMP]Removed extra '|' in attrs

9146. By Dharti Ratani(OpenERP)

[IMP]Checked that current timesheet is closed or not

9145. By Dharti Ratani(OpenERP)

[IMP]Added restriction for creating attendance from py if timesheet for an employee is in waiting approval or approved state

9144. By Dharti Ratani(OpenERP)

[IMP]Removed extra indentation

9143. By Dharti Ratani(OpenERP)

[FIX]Attendances can't be added on waiting approval and approved timesheets

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
2--- hr_timesheet_sheet/hr_timesheet_sheet.py 2013-05-08 08:59:38 +0000
3+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2013-06-10 11:57:27 +0000
4@@ -422,6 +422,7 @@
5 raise osv.except_osv(_('User Error!'), _('You cannot enter an attendance ' \
6 'date outside the current timesheet dates.'))
7 return res
8+
9
10 def _check(self, cr, uid, ids):
11 for att in self.browse(cr, uid, ids):
12@@ -431,6 +432,23 @@
13
14 hr_attendance()
15
16+class hr_employee(osv.osv):
17+ _inherit = "hr.employee"
18+ _description = "Employee"
19+
20+ def attendance_action_change(self, cr, uid, ids, context=None):
21+ timesheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
22+ timesheet_ids = timesheet_obj.search(cr, uid, [('employee_id', '=', ids[0])], context=context)
23+ current_date = time.strftime('%Y-%m-%d')
24+ for timesheet_id in timesheet_ids:
25+ timesheet = timesheet_obj.browse(cr, uid, timesheet_id, context)
26+ if timesheet.date_from < current_date < timesheet.date_to and timesheet.state not in ('draft','new'):
27+ raise osv.except_osv(_('Warning!'), _('You cannot add an attendance in a confirmed timesheet'))
28+ return super(hr_employee, self).attendance_action_change(cr, uid, ids, context=context)
29+
30+hr_employee()
31+
32+
33 class hr_timesheet_sheet_sheet_day(osv.osv):
34 _name = "hr_timesheet_sheet.sheet.day"
35 _description = "Timesheets by Period"