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
1=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.py'
2--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.py 2013-08-25 14:58:18 +0000
3+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.py 2013-09-05 20:36:39 +0000
4@@ -272,6 +272,11 @@
5 def wkf_close(self, cr, uid, ids, context=None):
6 """Change state from in progress to closed"""
7 o = self.browse(cr, uid, ids, context=context)[0]
8+ done_states = ['done', 'cancelled']
9+ if (o.immediate_action_id and o.immediate_action_id.state not in done_states):
10+ raise orm.except_orm(_('Error !'), _('Immediate action from analysis has not been closed.'))
11+ if ([i for i in o.action_ids if i.state not in done_states]):
12+ raise orm.except_orm(_('Error !'), _('Not all actions have been closed.'))
13 if not o.evaluation_date:
14 raise orm.except_orm(_('Error !'), _('Effectiveness evaluation must be performed before closing.'))
15 self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Close'))