Merge lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-with-new-warning-tpa into lp:openobject-addons
- trunk-stage-vs-status-with-new-warning-tpa
- Merge into trunk
Proposed by
Anto
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-with-new-warning-tpa |
Merge into: | lp:openobject-addons |
Diff against target: |
616 lines (+173/-30) 18 files modified
base_status/__openerp__.py (+1/-0) base_status/base_stage.py (+5/-3) base_status/static/src/css/base_status.css (+6/-0) crm/crm.py (+14/-0) crm/crm_lead.py (+2/-0) crm/crm_lead_data.xml (+4/-0) crm/crm_view.xml (+15/-6) crm_claim/crm_claim.py (+17/-0) crm_claim/crm_claim_data.xml (+3/-0) crm_claim/crm_claim_view.xml (+17/-9) hr_recruitment/hr_recruitment.py (+20/-0) hr_recruitment/hr_recruitment_data.xml (+9/-0) hr_recruitment/hr_recruitment_view.xml (+15/-4) project/project.py (+20/-1) project/project_data.xml (+4/-0) project/project_view.xml (+17/-5) project_issue/project_issue.py (+2/-0) project_issue/test/issue_demo.yml (+2/-2) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-with-new-warning-tpa |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Anto | Pending | ||
Review via email: mp+150510@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
- 8570. By Turkesh Patel (openERP)
-
[IMP] improved code of warning
- 8569. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8568. By Turkesh Patel (openERP)
-
[IMP] improve warnings related to stages.
- 8567. By Turkesh Patel (openERP)
-
[IMP] improved code.
- 8566. By Turkesh Patel (openERP)
-
[IMP] hr_recruitment: improved code
- 8565. By Turkesh Patel (openERP)
-
[IMP] project_issue: improve yml.
- 8564. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8563. By Turkesh Patel (openERP)
-
[IMP] project_issue: add warning.
- 8562. By Turkesh Patel (openERP)
-
[IMP] project:improved code
- 8561. By Turkesh Patel (openERP)
-
[IMP] improved wrningstring and default values
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'base_status/__openerp__.py' |
2 | --- base_status/__openerp__.py 2012-11-29 22:26:45 +0000 |
3 | +++ base_status/__openerp__.py 2013-02-26 09:48:36 +0000 |
4 | @@ -35,6 +35,7 @@ |
5 | 'depends': ['base'], |
6 | 'data': [], |
7 | 'demo': [], |
8 | + 'css': ['static/src/css/base_status.css'], |
9 | 'installable': True, |
10 | 'auto_install': False, |
11 | } |
12 | |
13 | === modified file 'base_status/base_stage.py' |
14 | --- base_status/base_stage.py 2012-12-21 13:48:10 +0000 |
15 | +++ base_status/base_stage.py 2013-02-26 09:48:36 +0000 |
16 | @@ -108,6 +108,7 @@ |
17 | |
18 | def _get_default_stage_id(self, cr, uid, context=None): |
19 | """ Gives default stage_id """ |
20 | + context.update({'state_name': 'draft',}) |
21 | return self.stage_find(cr, uid, [], None, [('state', '=', 'draft')], context=context) |
22 | |
23 | def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): |
24 | @@ -135,6 +136,7 @@ |
25 | """ |
26 | if isinstance(cases, (int, long)): |
27 | cases = self.browse(cr, uid, cases, context=context) |
28 | + context.update({'state_name': state_name,}) |
29 | for case in cases: |
30 | stage_id = self.stage_find(cr, uid, [case], None, [('state', '=', state_name)], context=context) |
31 | if stage_id: |
32 | @@ -254,10 +256,10 @@ |
33 | """ |
34 | cases = self.browse(cr, uid, ids, context=context) |
35 | # 1. update the stage |
36 | - if new_state_name: |
37 | + if not (new_stage_id is None): |
38 | + self.stage_set(cr, uid, ids, new_stage_id, context=context) |
39 | + elif new_state_name: |
40 | self.stage_set_with_state_name(cr, uid, cases, new_state_name, context=context) |
41 | - elif not (new_stage_id is None): |
42 | - self.stage_set(cr, uid, ids, new_stage_id, context=context) |
43 | # 2. update values |
44 | if values_to_update: |
45 | self.write(cr, uid, ids, values_to_update, context=context) |
46 | |
47 | === added directory 'base_status/static' |
48 | === added directory 'base_status/static/src' |
49 | === added directory 'base_status/static/src/css' |
50 | === added file 'base_status/static/src/css/base_status.css' |
51 | --- base_status/static/src/css/base_status.css 1970-01-01 00:00:00 +0000 |
52 | +++ base_status/static/src/css/base_status.css 2013-02-26 09:48:36 +0000 |
53 | @@ -0,0 +1,6 @@ |
54 | +.openerp .oe_stage_status_alert textarea { |
55 | + background-color: #ffc7c7; |
56 | + padding: 10px; |
57 | + height: 1em; |
58 | + margin-bottom: 20px; |
59 | +} |
60 | |
61 | === modified file 'crm/crm.py' |
62 | --- crm/crm.py 2012-12-18 09:32:41 +0000 |
63 | +++ crm/crm.py 2013-02-26 09:48:36 +0000 |
64 | @@ -87,6 +87,10 @@ |
65 | ('both', 'Both')], |
66 | string='Type', size=16, required=True, |
67 | help="This field is used to distinguish stages related to Leads from stages related to Opportunities, or to specify stages available for both types."), |
68 | + 'draft_state': fields.boolean('This stage contains newly created documents', help="This stage contains newly created documents."), |
69 | + 'done_state': fields.boolean('This stage contains closed documents', help="This stage contains closed documents."), |
70 | + 'cancel_state': fields.boolean('This stage contains cancelled documents', help="This stage contains cancelled documents."), |
71 | + 'alert': fields.text('Alert Message',readonly=True), |
72 | } |
73 | |
74 | _defaults = { |
75 | @@ -96,8 +100,18 @@ |
76 | 'fold': False, |
77 | 'type': 'both', |
78 | 'case_default': True, |
79 | + 'alert': "If you do not select any of the boolean field then this stage will be considered as 'In Progress.'", |
80 | } |
81 | |
82 | + def onchange_stage_state(self, cr, uid, ids, draft_state, done_state, cancel_state, context=None): |
83 | + if draft_state: |
84 | + return {'value':{'state':'draft', 'done_state': False, 'cancel_state': False}} |
85 | + if done_state: |
86 | + return {'value':{'state':'done', 'draft_state': False, 'cancel_state': False}} |
87 | + if cancel_state: |
88 | + return {'value':{'state':'cancel', 'done_state': False, 'draft_state': False}} |
89 | + return {'value':{'state':'open', 'draft_state': False, 'cancel_state': False, 'done_state': False}} |
90 | + |
91 | class crm_case_section(osv.osv): |
92 | """ Model for sales teams. """ |
93 | _name = "crm.case.section" |
94 | |
95 | === modified file 'crm/crm_lead.py' |
96 | --- crm/crm_lead.py 2013-02-21 10:52:47 +0000 |
97 | +++ crm/crm_lead.py 2013-02-26 09:48:36 +0000 |
98 | @@ -102,6 +102,7 @@ |
99 | |
100 | def _get_default_stage_id(self, cr, uid, context=None): |
101 | """ Gives default stage_id """ |
102 | + context.update({'state_name': 'draft',}) |
103 | section_id = self._get_default_section_id(cr, uid, context=context) |
104 | return self.stage_find(cr, uid, [], section_id, [('state', '=', 'draft')], context=context) |
105 | |
106 | @@ -408,6 +409,7 @@ |
107 | stage_ids = self.pool.get('crm.case.stage').search(cr, uid, search_domain, order=order, context=context) |
108 | if stage_ids: |
109 | return stage_ids[0] |
110 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Any stage related to '%s' state not found.\nPlease configure any one stage which will contain documents of this state in %%(menu:crm.menu_crm_lead_stage_act)s.")%context.get('state_name'), context) |
111 | return False |
112 | |
113 | def case_cancel(self, cr, uid, ids, context=None): |
114 | |
115 | === modified file 'crm/crm_lead_data.xml' |
116 | --- crm/crm_lead_data.xml 2013-01-30 09:09:42 +0000 |
117 | +++ crm/crm_lead_data.xml 2013-02-26 09:48:36 +0000 |
118 | @@ -7,6 +7,7 @@ |
119 | <field name="name">New</field> |
120 | <field eval="1" name="case_default"/> |
121 | <field name="state">draft</field> |
122 | + <field eval="True" name="draft_state"/> |
123 | <field eval="'10'" name="probability"/> |
124 | <field eval="'10'" name="sequence"/> |
125 | <field name="type">both</field> |
126 | @@ -47,6 +48,7 @@ |
127 | <field name="name">Won</field> |
128 | <field eval="1" name="case_default"/> |
129 | <field name="state">done</field> |
130 | + <field eval="True" name="done_state"/> |
131 | <field eval="'100'" name="probability"/> |
132 | <field eval="'15'" name="sequence"/> |
133 | <field eval="1" name="on_change"/> |
134 | @@ -57,6 +59,7 @@ |
135 | <field eval="1" name="case_default"/> |
136 | <field eval="False" name="fold"/> |
137 | <field name="state">cancel</field> |
138 | + <field eval="True" name="cancel_state"/> |
139 | <field eval="'0'" name="probability"/> |
140 | <field eval="'16'" name="sequence"/> |
141 | <field name="type">lead</field> |
142 | @@ -67,6 +70,7 @@ |
143 | <field eval="True" name="fold"/> |
144 | <field eval="1" name="on_change"/> |
145 | <field name="state">cancel</field> |
146 | + <field eval="True" name="cancel_state"/> |
147 | <field eval="'0'" name="probability"/> |
148 | <field eval="'17'" name="sequence"/> |
149 | <field name="type">opportunity</field> |
150 | |
151 | === modified file 'crm/crm_view.xml' |
152 | --- crm/crm_view.xml 2012-12-18 14:08:42 +0000 |
153 | +++ crm/crm_view.xml 2013-02-26 09:48:36 +0000 |
154 | @@ -183,7 +183,6 @@ |
155 | <field name="sequence" widget="handle"/> |
156 | <field name="name"/> |
157 | <field name="probability"/> |
158 | - <field name="state"/> |
159 | <field name="type"/> |
160 | </tree> |
161 | </field> |
162 | @@ -199,17 +198,27 @@ |
163 | <form string="Stage" version="7.0"> |
164 | <group col="4"> |
165 | <field name="name"/> |
166 | - <field name="state"/> |
167 | <field name="probability"/> |
168 | <field name="type"/> |
169 | <field name="on_change"/> |
170 | <field name="sequence"/> |
171 | <field name="case_default"/> |
172 | <field name="fold"/> |
173 | - </group> |
174 | - <separator string="Requirements"/> |
175 | - <field name="requirements" nolabel="1"/> |
176 | - <field name="section_ids" invisible="1"/> |
177 | + <field name="state" invisible="1"/> |
178 | + </group> |
179 | + <group> |
180 | + <group string="Column Status"> |
181 | + <field name='alert' attrs="{'invisible': [('state','in',('draft','cancel','done'))]}" class="oe_inline oe_stage_status_alert" nolabel="1"/> |
182 | + <newline/> |
183 | + <field name="draft_state" on_change="onchange_stage_state(draft_state,False,False)" attrs="{'invisible': ['|', ('done_state', '=', True), ('cancel_state', '=', True)]}"/> |
184 | + <field name="done_state" on_change="onchange_stage_state(False,done_state,False)" attrs="{'invisible': ['|', ('draft_state', '=', True), ('cancel_state', '=', True)]}"/> |
185 | + <field name="cancel_state" on_change="onchange_stage_state(False,False,cancel_state)" attrs="{'invisible': ['|', ('done_state', '=', True), ('draft_state', '=', True)]}"/> |
186 | + </group> |
187 | + <group string="Requirements"> |
188 | + <field name="requirements" nolabel="1"/> |
189 | + <field name="section_ids" invisible="1"/> |
190 | + </group> |
191 | + </group> |
192 | </form> |
193 | </field> |
194 | </record> |
195 | |
196 | === modified file 'crm_claim/crm_claim.py' |
197 | --- crm_claim/crm_claim.py 2013-01-15 13:43:59 +0000 |
198 | +++ crm_claim/crm_claim.py 2013-02-26 09:48:36 +0000 |
199 | @@ -57,15 +57,31 @@ |
200 | help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."), |
201 | 'fold': fields.boolean('Hide in Views when Empty', |
202 | help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), |
203 | + 'draft_state': fields.boolean('This stage contains newly created documents', help="This stage contains newly created documents."), |
204 | + 'done_state': fields.boolean('This stage contains closed documents', help="This stage contains closed documents."), |
205 | + 'cancel_state': fields.boolean('This stage contains cancelled documents', help="This stage contains cancelled documents."), |
206 | + 'alert': fields.text('Alert Message',readonly=True), |
207 | } |
208 | |
209 | _defaults = { |
210 | 'sequence': lambda *args: 1, |
211 | 'state': 'draft', |
212 | + 'draft_state': True, |
213 | 'fold': False, |
214 | 'case_refused': False, |
215 | + 'alert': "If you do not select any of the boolean field then this stage will be considered as 'In Progress.'", |
216 | } |
217 | |
218 | + def onchange_stage_state(self, cr, uid, ids, draft_state, done_state, cancel_state, context=None): |
219 | + if draft_state: |
220 | + return {'value':{'state':'draft', 'done_state': False, 'cancel_state': False}} |
221 | + if done_state: |
222 | + return {'value':{'state':'done', 'draft_state': False, 'cancel_state': False}} |
223 | + if cancel_state: |
224 | + return {'value':{'state':'cancel', 'done_state': False, 'draft_state': False}} |
225 | + return {'value':{'state':'open', 'draft_state': False, 'cancel_state': False, 'done_state': False}} |
226 | + |
227 | + |
228 | class crm_claim(base_stage, osv.osv): |
229 | """ Crm claim |
230 | """ |
231 | @@ -156,6 +172,7 @@ |
232 | stage_ids = self.pool.get('crm.claim.stage').search(cr, uid, search_domain, order=order, context=context) |
233 | if stage_ids: |
234 | return stage_ids[0] |
235 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Any stage related to '%s' state not found.\nPlease configure any one stage which will contain documents of this state in %%(menu:crm_claim.menu_claim_stage_view)s.")%context.get('state_name'), context) |
236 | return False |
237 | |
238 | def case_refuse(self, cr, uid, ids, context=None): |
239 | |
240 | === modified file 'crm_claim/crm_claim_data.xml' |
241 | --- crm_claim/crm_claim_data.xml 2012-11-29 22:26:45 +0000 |
242 | +++ crm_claim/crm_claim_data.xml 2013-02-26 09:48:36 +0000 |
243 | @@ -45,6 +45,7 @@ |
244 | <record model="crm.claim.stage" id="stage_claim1"> |
245 | <field name="name">New</field> |
246 | <field name="state">draft</field> |
247 | + <field eval="True" name="draft_state"/> |
248 | <field name="sequence">26</field> |
249 | <field name="case_default" eval="True"/> |
250 | </record> |
251 | @@ -57,12 +58,14 @@ |
252 | <record model="crm.claim.stage" id="stage_claim2"> |
253 | <field name="name">Settled</field> |
254 | <field name="state">done</field> |
255 | + <field eval="True" name="done_state"/> |
256 | <field name="sequence">28</field> |
257 | <field name="case_default" eval="True"/> |
258 | </record> |
259 | <record model="crm.claim.stage" id="stage_claim3"> |
260 | <field name="name">Rejected</field> |
261 | <field name="state">cancel</field> |
262 | + <field eval="True" name="cancel_state"/> |
263 | <field name="sequence">29</field> |
264 | <field name="case_default" eval="True"/> |
265 | <field name="case_refused" eval="True"/> |
266 | |
267 | === modified file 'crm_claim/crm_claim_view.xml' |
268 | --- crm_claim/crm_claim_view.xml 2012-11-29 22:26:45 +0000 |
269 | +++ crm_claim/crm_claim_view.xml 2013-02-26 09:48:36 +0000 |
270 | @@ -36,9 +36,8 @@ |
271 | <field name="model">crm.claim.stage</field> |
272 | <field name="arch" type="xml"> |
273 | <tree string="Claim Stages"> |
274 | + <field name="name"/> |
275 | <field name="sequence"/> |
276 | - <field name="name"/> |
277 | - <field name="state"/> |
278 | </tree> |
279 | </field> |
280 | </record> |
281 | @@ -47,13 +46,22 @@ |
282 | <field name="name">crm.claim.stage.form</field> |
283 | <field name="model">crm.claim.stage</field> |
284 | <field name="arch" type="xml"> |
285 | - <form string="Claim Stage"> |
286 | - <field name="name"/> |
287 | - <field name="case_default"/> |
288 | - <field name="sequence"/> |
289 | - <field name="state"/> |
290 | - <field name="case_refused"/> |
291 | - <field name="fold"/> |
292 | + <form string="Claim Stage" version="7.0"> |
293 | + <group col="4"> |
294 | + <field name="name"/> |
295 | + <field name="case_default"/> |
296 | + <field name="sequence"/> |
297 | + <field name="case_refused"/> |
298 | + <field name="fold"/> |
299 | + <field name="state" invisible="1"/> |
300 | + </group> |
301 | + <group string="Column Status"> |
302 | + <field name='alert' attrs="{'invisible': [('state','in',('draft','cancel','done'))]}" class="oe_inline oe_stage_status_alert" nolabel="1"/> |
303 | + <newline/> |
304 | + <field name="draft_state" on_change="onchange_stage_state(draft_state,False,False)" attrs="{'invisible': ['|', ('done_state', '=', True), ('cancel_state', '=', True)]}"/> |
305 | + <field name="done_state" on_change="onchange_stage_state(False,done_state,False)" attrs="{'invisible': ['|', ('draft_state', '=', True), ('cancel_state', '=', True)]}"/> |
306 | + <field name="cancel_state" on_change="onchange_stage_state(False,False,cancel_state)" attrs="{'invisible': ['|', ('done_state', '=', True), ('draft_state', '=', True)]}"/> |
307 | + </group> |
308 | </form> |
309 | </field> |
310 | </record> |
311 | |
312 | === modified file 'hr_recruitment/hr_recruitment.py' |
313 | --- hr_recruitment/hr_recruitment.py 2013-02-24 11:52:27 +0000 |
314 | +++ hr_recruitment/hr_recruitment.py 2013-02-26 09:48:36 +0000 |
315 | @@ -65,13 +65,31 @@ |
316 | 'state': fields.selection(AVAILABLE_STATES, 'Status', required=True, help="The related status for the stage. The status of your document will automatically change according to the selected stage. Example, a stage is related to the status 'Close', when your document reach this stage, it will be automatically closed."), |
317 | 'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), |
318 | 'requirements': fields.text('Requirements'), |
319 | + 'draft_state': fields.boolean('This stage contains newly created applications', help="This stage contains newly created applications."), |
320 | + 'pending_state': fields.boolean('This stage contains pending applications', help="This stage contains pending applications."), |
321 | + 'done_state': fields.boolean('This stage contains hired applications', help="This stage contains hired applications."), |
322 | + 'cancel_state': fields.boolean('This stage contains refused applications', help="This stage contains refused applications."), |
323 | + 'alert': fields.text('Alert Message',readonly=True), |
324 | } |
325 | _defaults = { |
326 | 'sequence': 1, |
327 | 'state': 'draft', |
328 | + 'draft_state': True, |
329 | 'fold': False, |
330 | + 'alert': "If you do not select any of the boolean field then this stage will be considered as 'In Progress.'", |
331 | } |
332 | |
333 | + def onchange_stage_state(self, cr, uid, ids, draft_state, pending_state, done_state, cancel_state, context=None): |
334 | + if draft_state: |
335 | + return {'value':{'state':'draft', 'done_state': False, 'cancel_state': False, 'pending_state': False}} |
336 | + if pending_state: |
337 | + return {'value':{'state':'pending', 'done_state': False, 'draft_state': False, 'cancel_state': False}} |
338 | + if done_state: |
339 | + return {'value':{'state':'done', 'draft_state': False, 'cancel_state': False, 'pending_state': False}} |
340 | + if cancel_state: |
341 | + return {'value':{'state':'cancel', 'done_state': False, 'draft_state': False, 'pending_state': False}} |
342 | + return {'value':{'state':'open', 'draft_state': False, 'cancel_state': False, 'done_state': False, 'pending_state': False}} |
343 | + |
344 | class hr_recruitment_degree(osv.osv): |
345 | """ Degree of HR Recruitment """ |
346 | _name = "hr.recruitment.degree" |
347 | @@ -108,6 +126,7 @@ |
348 | |
349 | def _get_default_stage_id(self, cr, uid, context=None): |
350 | """ Gives default stage_id """ |
351 | + context.update({'state_name': 'draft',}) |
352 | department_id = self._get_default_department_id(cr, uid, context=context) |
353 | return self.stage_find(cr, uid, [], department_id, [('state', '=', 'draft')], context=context) |
354 | |
355 | @@ -304,6 +323,7 @@ |
356 | stage_ids = self.pool.get('hr.recruitment.stage').search(cr, uid, search_domain, order=order, context=context) |
357 | if stage_ids: |
358 | return stage_ids[0] |
359 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Any stage related to '%s' state not found.\nPlease configure any one stage which will contain documents of this state in %%(menu:hr_recruitment.menu_hr_recruitment_stage)s.")%context.get('state_name'), context) |
360 | return False |
361 | |
362 | def action_makeMeeting(self, cr, uid, ids, context=None): |
363 | |
364 | === modified file 'hr_recruitment/hr_recruitment_data.xml' |
365 | --- hr_recruitment/hr_recruitment_data.xml 2013-01-30 13:58:25 +0000 |
366 | +++ hr_recruitment/hr_recruitment_data.xml 2013-02-26 09:48:36 +0000 |
367 | @@ -54,31 +54,40 @@ |
368 | <record model="hr.recruitment.stage" id="stage_job1"> |
369 | <field name="name">Initial Qualification</field> |
370 | <field name="state">draft</field> |
371 | + <field eval="True" name="draft_state"/> |
372 | <field name="sequence">1</field> |
373 | </record> |
374 | <record model="hr.recruitment.stage" id="stage_job2"> |
375 | <field name="name">First Interview</field> |
376 | <field name="state">open</field> |
377 | + <field eval="False" name="draft_state"/> |
378 | <field name="sequence">2</field> |
379 | </record> |
380 | <record model="hr.recruitment.stage" id="stage_job3"> |
381 | <field name="name">Second Interview</field> |
382 | <field name="state">open</field> |
383 | + <field eval="False" name="draft_state"/> |
384 | <field name="sequence">3</field> |
385 | </record> |
386 | <record model="hr.recruitment.stage" id="stage_job4"> |
387 | <field name="name">Contract Proposed</field> |
388 | <field name="state">pending</field> |
389 | + <field eval="True" name="pending_state"/> |
390 | + <field eval="False" name="draft_state"/> |
391 | <field name="sequence">4</field> |
392 | </record> |
393 | <record model="hr.recruitment.stage" id="stage_job5"> |
394 | <field name="name">Contract Signed</field> |
395 | <field name="state">done</field> |
396 | + <field eval="True" name="done_state"/> |
397 | + <field eval="False" name="draft_state"/> |
398 | <field name="sequence">5</field> |
399 | </record> |
400 | <record model="hr.recruitment.stage" id="stage_job6"> |
401 | <field name="name">Refused</field> |
402 | <field name="state">cancel</field> |
403 | + <field eval="True" name="cancel_state"/> |
404 | + <field eval="False" name="draft_state"/> |
405 | <field name="sequence">6</field> |
406 | <field name="fold" eval="True"/> |
407 | </record> |
408 | |
409 | === modified file 'hr_recruitment/hr_recruitment_view.xml' |
410 | --- hr_recruitment/hr_recruitment_view.xml 2013-02-11 12:57:51 +0000 |
411 | +++ hr_recruitment/hr_recruitment_view.xml 2013-02-26 09:48:36 +0000 |
412 | @@ -328,7 +328,6 @@ |
413 | <field name="sequence" invisible="1"/> |
414 | <field name="name"/> |
415 | <field name="department_id"/> |
416 | - <field name="state"/> |
417 | </tree> |
418 | </field> |
419 | </record> |
420 | @@ -345,13 +344,25 @@ |
421 | <field name="department_id"/> |
422 | </group> |
423 | <group> |
424 | - <field name="state"/> |
425 | + <field name="state" invisible="1"/> |
426 | <field name="sequence"/> |
427 | <field name="fold"/> |
428 | </group> |
429 | </group> |
430 | - <separator string="Requirements"/> |
431 | - <field name="requirements"/> |
432 | + <group> |
433 | + <group string="Column status"> |
434 | + <field name='alert' attrs="{'invisible': [('state','in',('draft','cancel','done','pending'))]}" class="oe_inline oe_stage_status_alert" nolabel="1"/> |
435 | + <newline/> |
436 | + <field name="draft_state" on_change="onchange_stage_state(draft_state,False,False,False)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('cancel_state', '=', True), ('pending_state', '=', True)]}"/> |
437 | + <field name="pending_state" on_change="onchange_stage_state(False,pending_state,False,False)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('cancel_state', '=', True), ('draft_state', '=', True)]}"/> |
438 | + <field name="done_state" on_change="onchange_stage_state(False,False,done_state,False)" attrs="{'invisible': ['|','|', ('draft_state', '=', True), ('cancel_state', '=', True), ('pending_state', '=', True)]}"/> |
439 | + <field name="cancel_state" on_change="onchange_stage_state(False,False,False,cancel_state)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('draft_state', '=', True), ('pending_state', '=', True)]}"/> |
440 | + </group> |
441 | + <group string="Requirements"> |
442 | + <field name="requirements" nolabel="1"/> |
443 | + </group> |
444 | + </group> |
445 | + |
446 | </form> |
447 | </field> |
448 | </record> |
449 | |
450 | === modified file 'project/project.py' |
451 | --- project/project.py 2013-01-15 10:03:53 +0000 |
452 | +++ project/project.py 2013-02-26 09:48:36 +0000 |
453 | @@ -49,6 +49,11 @@ |
454 | "For example, if a stage is related to the status 'Close', when your document reaches this stage, it is automatically closed."), |
455 | 'fold': fields.boolean('Folded by Default', |
456 | help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), |
457 | + 'draft_state': fields.boolean('This stage contains newly created documents', help="This stage contains newly created documents."), |
458 | + 'done_state': fields.boolean('This stage contains closed documents', help="This stage contains closed documents."), |
459 | + 'pending_state': fields.boolean('This stage contains pending documents', help="This stage contains pending documents."), |
460 | + 'cancelled_state': fields.boolean('This stage contains cancelled documents', help="This stage contains cancelled documents."), |
461 | + 'alert': fields.text('Alert Message',readonly=True), |
462 | } |
463 | def _get_default_project_id(self, cr, uid, ctx={}): |
464 | proj = ctx.get('default_project_id', False) |
465 | @@ -60,10 +65,22 @@ |
466 | 'state': 'open', |
467 | 'fold': False, |
468 | 'case_default': False, |
469 | - 'project_ids': _get_default_project_id |
470 | + 'project_ids': _get_default_project_id, |
471 | + 'alert': "If you do not select any of the boolean field then this stage will be considered as 'In Progress.'", |
472 | } |
473 | _order = 'sequence' |
474 | |
475 | + def onchange_stage_state(self, cr, uid, ids, draft_state, pending_state, done_state, cancelled_state, context=None): |
476 | + if draft_state: |
477 | + return {'value':{'state':'draft', 'done_state': False, 'cancelled_state': False, 'pending_state': False}} |
478 | + if pending_state: |
479 | + return {'value':{'state':'pending', 'done_state': False, 'draft_state': False, 'cancelled_state': False}} |
480 | + if done_state: |
481 | + return {'value':{'state':'done', 'draft_state': False, 'cancelled_state': False, 'pending_state': False}} |
482 | + if cancelled_state: |
483 | + return {'value':{'state':'cancelled', 'done_state': False, 'draft_state': False, 'pending_state': False}} |
484 | + return {'value':{'state':'open', 'draft_state': False, 'cancelled_state': False, 'done_state': False, 'pending_state': False}} |
485 | + |
486 | def short_name(name): |
487 | """Keep first word(s) of name to make it small enough |
488 | but distinctive""" |
489 | @@ -578,6 +595,7 @@ |
490 | |
491 | def _get_default_stage_id(self, cr, uid, context=None): |
492 | """ Gives default stage_id """ |
493 | + context.update({'state_name': 'draft',}) |
494 | project_id = self._get_default_project_id(cr, uid, context=context) |
495 | return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context) |
496 | |
497 | @@ -919,6 +937,7 @@ |
498 | stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) |
499 | if stage_ids: |
500 | return stage_ids[0] |
501 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Any stage related to '%s' state not found.\nPlease configure any one stage which will contain documents of this state in %%(menu:project.menu_task_types_view)s.")%context.get('state_name'), context) |
502 | return False |
503 | |
504 | def _check_child_task(self, cr, uid, ids, context=None): |
505 | |
506 | === modified file 'project/project_data.xml' |
507 | --- project/project_data.xml 2013-01-30 09:09:42 +0000 |
508 | +++ project/project_data.xml 2013-02-26 09:48:36 +0000 |
509 | @@ -30,12 +30,14 @@ |
510 | <field name="sequence">1</field> |
511 | <field name="name">Analysis</field> |
512 | <field name="state">draft</field> |
513 | + <field eval="True" name="draft_state"/> |
514 | <field name="case_default" eval="False"/> |
515 | </record> |
516 | <record id="project_tt_specification" model="project.task.type"> |
517 | <field name="sequence">2</field> |
518 | <field name="name">Specification</field> |
519 | <field name="state">pending</field> |
520 | + <field eval="True" name="pending_state"/> |
521 | <field name="case_default" eval="True"/> |
522 | </record> |
523 | <record id="project_tt_design" model="project.task.type"> |
524 | @@ -67,6 +69,7 @@ |
525 | <field name="sequence">100</field> |
526 | <field name="name">Done</field> |
527 | <field name="state">done</field> |
528 | + <field eval="True" name="done_state"/> |
529 | <field name="case_default" eval="True"/> |
530 | <field name="fold" eval="True"/> |
531 | </record> |
532 | @@ -74,6 +77,7 @@ |
533 | <field name="sequence">200</field> |
534 | <field name="name">Cancelled</field> |
535 | <field name="state">cancelled</field> |
536 | + <field eval="True" name="cancelled_state"/> |
537 | <field name="case_default" eval="True"/> |
538 | <field name="fold" eval="True"/> |
539 | </record> |
540 | |
541 | === modified file 'project/project_view.xml' |
542 | --- project/project_view.xml 2013-02-25 12:03:31 +0000 |
543 | +++ project/project_view.xml 2013-02-26 09:48:36 +0000 |
544 | @@ -689,12 +689,24 @@ |
545 | <field name="case_default"/> |
546 | </group> |
547 | <group> |
548 | - <field name="state"/> |
549 | <field name="sequence"/> |
550 | <field name="fold"/> |
551 | - </group> |
552 | - </group> |
553 | - <field name="description" placeholder="Add a description..."/> |
554 | + <field name="state" invisible="1"/> |
555 | + </group> |
556 | + </group> |
557 | + <group> |
558 | + <group string="Column Status"> |
559 | + <field name='alert' attrs="{'invisible': [('state','in',('draft','cancelled','done','pending'))]}" class="oe_inline oe_stage_status_alert" nolabel="1"/> |
560 | + <newline/> |
561 | + <field name="draft_state" on_change="onchange_stage_state(draft_state,False,False,False)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('cancelled_state', '=', True), ('pending_state', '=', True)]}"/> |
562 | + <field name="pending_state" on_change="onchange_stage_state(False,pending_state,False,False)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('cancelled_state', '=', True), ('draft_state', '=', True)]}"/> |
563 | + <field name="done_state" on_change="onchange_stage_state(False,False,done_state,False)" attrs="{'invisible': ['|','|', ('draft_state', '=', True), ('cancelled_state', '=', True), ('pending_state', '=', True)]}"/> |
564 | + <field name="cancelled_state" on_change="onchange_stage_state(False,False,False,cancelled_state)" attrs="{'invisible': ['|','|', ('done_state', '=', True), ('draft_state', '=', True), ('pending_state', '=', True)]}"/> |
565 | + </group> |
566 | + <group string="Description"> |
567 | + <field name="description" placeholder="Add a description..." nolabel="1"/> |
568 | + </group> |
569 | + </group> |
570 | </form> |
571 | </field> |
572 | </record> |
573 | @@ -706,7 +718,7 @@ |
574 | <tree string="Task Stage"> |
575 | <field name="sequence" widget="handle"/> |
576 | <field name="name"/> |
577 | - <field name="state"/> |
578 | + <field name="case_default"/> |
579 | </tree> |
580 | </field> |
581 | </record> |
582 | |
583 | === modified file 'project_issue/project_issue.py' |
584 | --- project_issue/project_issue.py 2013-01-15 13:43:59 +0000 |
585 | +++ project_issue/project_issue.py 2013-02-26 09:48:36 +0000 |
586 | @@ -80,6 +80,7 @@ |
587 | |
588 | def _get_default_stage_id(self, cr, uid, context=None): |
589 | """ Gives default stage_id """ |
590 | + context.update({'state_name': 'draft',}) |
591 | project_id = self._get_default_project_id(cr, uid, context=context) |
592 | return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context) |
593 | |
594 | @@ -454,6 +455,7 @@ |
595 | stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) |
596 | if stage_ids: |
597 | return stage_ids[0] |
598 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Any stage related to '%s' state not found.\nPlease configure any one stage which will contain documents of this state in %%(menu:project.menu_task_types_view)s.")%context.get('state_name'), context) |
599 | return False |
600 | |
601 | def case_cancel(self, cr, uid, ids, context=None): |
602 | |
603 | === modified file 'project_issue/test/issue_demo.yml' |
604 | --- project_issue/test/issue_demo.yml 2012-11-29 22:26:45 +0000 |
605 | +++ project_issue/test/issue_demo.yml 2013-02-26 09:48:36 +0000 |
606 | @@ -1,8 +1,8 @@ |
607 | - |
608 | !record {model: project.issue, id: project_task_1, view: False}: |
609 | - task_id: 'project.project_task_17' |
610 | + task_id: 'project.project_task_1' |
611 | name: 'Error in account module' |
612 | - |
613 | !record {model: project.issue, id: project01, view: False}: |
614 | - project_id: 'project.project_project_2' |
615 | + project_id: 'project.project_project_1' |
616 | name: 'OpenERP Integration' |