Merge lp:~openerp-dev/openobject-addons/6.1-opw-578933-nep into lp:openobject-addons/6.1

Proposed by Nehal Panchal (OpenERP)
Status: Rejected
Rejected by: Naresh(OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-578933-nep
Merge into: lp:openobject-addons/6.1
Diff against target: 20 lines (+3/-1)
1 file modified
hr/hr.py (+3/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-578933-nep
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Needs Fixing
Naresh(OpenERP) Pending
Review via email: mp+123733@code.launchpad.net

Description of the change

Hello,

Unable to delete the employee.

Unlink() method of hr.employee is deleting a resource associated with an employee before deleting an employee. And so employee unlink() will work on resource which has already been deleted from database.

This fixes the issue.

Thanks.

To post a comment you must log in.
6986. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6987. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This patch looks very wrong, now the "if resource_ids" test will never pass as 'resource_ids' is initialized to an empty list in the previous line. Please review your patches before submitting such nonsense ;-)
If you'd like to delete the employees before the resources they inherit from you should simply put the call to resource.unlink() *after* the call to super().unlink().

review: Needs Fixing
6988. By Olivier Dony (Odoo)

[FIX] account_analytic_analysis: reminder should report consumed hours using the correct field

As the hours_quantity field is used to flag an account
as `to renew`, it should be used as well when reporting
the consumed quantity.

6989. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6990. By Nehal Panchal (OpenERP)

[FIX] hr : Unable to delete an employee

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi,

here is a superseding merge request that takes Olivier Dony's remarks into account: lp:~therp-nl/openobject-addons/6.1-lp1049199-delete_employees_before_resources

Cheers,
Stefan.

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

Rejecting this one as the mp given in above comment is more cleaner !

Thanks,
Naresh Soni

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Naresh,

thank you. It seems my comment looks a bit exaggerated as my branch and Nehal's only show a minimal difference now. I suspect that Nehal's had not been pushed to Launchpad yet when I proposed my version as it still looked quite different then.

Cheers,
Stefan.

Unmerged revisions

6990. By Nehal Panchal (OpenERP)

[FIX] hr : Unable to delete an employee

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr/hr.py'
2--- hr/hr.py 2012-01-31 13:36:57 +0000
3+++ hr/hr.py 2012-09-14 11:10:23 +0000
4@@ -180,13 +180,15 @@
5 def unlink(self, cr, uid, ids, context=None):
6 resource_obj = self.pool.get('resource.resource')
7 resource_ids = []
8+ unlink_status = False
9 for employee in self.browse(cr, uid, ids, context=context):
10 resource = employee.resource_id
11 if resource:
12 resource_ids.append(resource.id)
13+ unlink_status = super(hr_employee, self).unlink(cr, uid, ids, context=context)
14 if resource_ids:
15 resource_obj.unlink(cr, uid, resource_ids, context=context)
16- return super(hr_employee, self).unlink(cr, uid, ids, context=context)
17+ return unlink_status
18
19 def onchange_address_id(self, cr, uid, ids, address, context=None):
20 if address: