Merge lp:~savoirfairelinux-openerp/openerp-mgmtsystem/bug-1219854 into lp:openerp-mgmtsystem

Status: Merged
Merged at revision: 78
Proposed branch: lp:~savoirfairelinux-openerp/openerp-mgmtsystem/bug-1219854
Merge into: lp:openerp-mgmtsystem
Diff against target: 15 lines (+5/-0)
1 file modified
mgmtsystem_nonconformity/mgmtsystem_nonconformity.py (+5/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-mgmtsystem/bug-1219854
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) lgtm, no test Approve
Daniel Reis code review, no test Approve
Review via email: mp+183936@code.launchpad.net

Description of the change

Added check in wtk_close which raises an exception if it contains an action that is not 'done'.

To post a comment you must log in.
78. By Sandy Carter (http://www.savoirfairelinux.com)

Exception when closing NC that has non closed actions.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (lgtm, no test)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

You should check for Actions not in ['done','cancelled'].
Also check the other one2many on Actions (there is at least one for Immediate Action).

review: Needs Fixing
79. By Sandy Carter (http://www.savoirfairelinux.com)

Added state 'cancelled' and check for immediate actions.

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Looks perfect to me!

review: Approve (code review, no test)
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (lgtm, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.py'
--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.py 2013-08-25 14:58:18 +0000
+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.py 2013-09-05 20:36:39 +0000
@@ -272,6 +272,11 @@
272 def wkf_close(self, cr, uid, ids, context=None):272 def wkf_close(self, cr, uid, ids, context=None):
273 """Change state from in progress to closed"""273 """Change state from in progress to closed"""
274 o = self.browse(cr, uid, ids, context=context)[0]274 o = self.browse(cr, uid, ids, context=context)[0]
275 done_states = ['done', 'cancelled']
276 if (o.immediate_action_id and o.immediate_action_id.state not in done_states):
277 raise orm.except_orm(_('Error !'), _('Immediate action from analysis has not been closed.'))
278 if ([i for i in o.action_ids if i.state not in done_states]):
279 raise orm.except_orm(_('Error !'), _('Not all actions have been closed.'))
275 if not o.evaluation_date:280 if not o.evaluation_date:
276 raise orm.except_orm(_('Error !'), _('Effectiveness evaluation must be performed before closing.'))281 raise orm.except_orm(_('Error !'), _('Effectiveness evaluation must be performed before closing.'))
277 self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Close'))282 self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Close'))