Merge lp:~unifield-team/unifield-wm/UF_2017 into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 1770
Proposed branch: lp:~unifield-team/unifield-wm/UF_2017
Merge into: lp:unifield-wm
Diff against target: 64 lines (+51/-0)
2 files modified
msf_instance/__init__.py (+1/-0)
msf_instance/account.py (+50/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/UF_2017
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+180124@code.launchpad.net
To post a comment you must log in.
1730. By Olivier DOSSMANN

UF-2017 [FIX] Raise only an error on hq entries for period that change from "Field closed" to "Mission closed"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'msf_instance/__init__.py'
2--- msf_instance/__init__.py 2013-02-06 10:55:05 +0000
3+++ msf_instance/__init__.py 2013-09-09 15:23:29 +0000
4@@ -24,4 +24,5 @@
5 import add_instance
6 import msf_instance_installer
7 import wizard
8+import account
9 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
10
11=== added file 'msf_instance/account.py'
12--- msf_instance/account.py 1970-01-01 00:00:00 +0000
13+++ msf_instance/account.py 2013-09-09 15:23:29 +0000
14@@ -0,0 +1,50 @@
15+# -*- coding: utf-8 -*-
16+##############################################################################
17+#
18+# OpenERP, Open Source Management Solution
19+# Copyright (C) 2011 MSF, TeMPO consulting
20+#
21+# This program is free software: you can redistribute it and/or modify
22+# it under the terms of the GNU Affero General Public License as
23+# published by the Free Software Foundation, either version 3 of the
24+# License, or (at your option) any later version.
25+#
26+# This program is distributed in the hope that it will be useful,
27+# but WITHOUT ANY WARRANTY; without even the implied warranty of
28+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+# GNU Affero General Public License for more details.
30+#
31+# You should have received a copy of the GNU Affero General Public License
32+# along with this program. If not, see <http://www.gnu.org/licenses/>.
33+#
34+##############################################################################
35+
36+from osv import osv
37+from tools.translate import _
38+
39+class account_period(osv.osv):
40+ _name = 'account.period'
41+ _inherit = 'account.period'
42+
43+ def action_set_state(self, cr, uid, ids, context=None):
44+ """
45+ Check that all hq entries from the given period are validated.
46+ This check is only done on COORDO level!
47+ """
48+ # Some verifications
49+ if not context:
50+ context = {}
51+ # Are we in coordo level?
52+ user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
53+ if user and user.company_id and user.company_id.instance_id and user.company_id.instance_id.level and user.company_id.instance_id.level == 'coordo':
54+ # Check hq entries
55+ period_ids = self.search(cr, uid, [('id', 'in', ids), ('state', '=', 'draft')])
56+ if isinstance(period_ids, (int, long)):
57+ period_ids = [period_ids]
58+ hq_ids = self.pool.get('hq.entries').search(cr, uid, [('period_id', 'in', period_ids), ('user_validated', '=', False)])
59+ if hq_ids:
60+ raise osv.except_osv(_('Warning'), _('Some HQ entries are not validated in this period. Please validate them before field-closing this period.'))
61+ return super(account_period, self).action_set_state(cr, uid, ids, context)
62+
63+account_period()
64+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches