Merge lp:~openerp-dev/openobject-addons/trunk-kanban-column-vme into lp:openobject-addons
- trunk-kanban-column-vme
- Merge into trunk
Proposed by
Vidhin Mehta (OpenERP)
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-kanban-column-vme |
Merge into: | lp:openobject-addons |
Diff against target: |
503 lines (+274/-33) 11 files modified
crm/crm.py (+56/-0) crm/crm_lead.py (+1/-1) crm/crm_lead_view.xml (+1/-1) hr/hr_demo.xml (+1/-1) hr/hr_view.xml (+2/-0) hr_recruitment/hr_recruitment.py (+107/-26) hr_recruitment/hr_recruitment_demo.xml (+30/-1) hr_recruitment/hr_recruitment_menu.xml (+18/-1) hr_recruitment/hr_recruitment_view.xml (+3/-1) project/project.py (+53/-0) project/security/ir.model.access.csv (+2/-1) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-kanban-column-vme |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+171049@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 8781. By Vidhin Mehta (OpenERP)
-
[IMP]project.py fixes and improvements.
- 8782. By Vidhin Mehta (OpenERP)
-
[IMP]improvement in view
- 8783. By Vidhin Mehta (OpenERP)
-
[IMP]Improvements in hr module (P1).
- 8784. By Vidhin Mehta (OpenERP)
-
[IMP]Improvement in project csv
- 8785. By Vidhin Mehta (OpenERP)
-
[IMP] Improvements in crm.
- 8786. By Vidhin Mehta (OpenERP)
-
[MERGE]Trunk.
- 8787. By Vidhin Mehta (OpenERP)
-
[IMP]give proper name of methods.
- 8788. By Vidhin Mehta (OpenERP)
-
[IMP]IMprovements in hr_recuriment
- 8789. By Vidhin Mehta (OpenERP)
-
[IMP]misspel.
- 8790. By Vidhin Mehta (OpenERP)
-
[IMP]Add some demo data.
- 8791. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8792. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8793. By Vidhin Mehta (OpenERP)
-
[IMP]FIX
- 8794. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8795. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8796. By Vidhin Mehta (OpenERP)
-
[Imp]
- 8797. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8798. By Vidhin Mehta (OpenERP)
-
[IMP]Change condition in crm_lead def stage_modify
- 8799. By Vidhin Mehta (OpenERP)
-
[MERGE]Trunk.
- 8800. By Vidhin Mehta (OpenERP)
-
[IMP]add demo data.
- 8801. By RGA(OpenERP)
-
Merge with trunk
Unmerged revisions
- 8801. By RGA(OpenERP)
-
Merge with trunk
- 8800. By Vidhin Mehta (OpenERP)
-
[IMP]add demo data.
- 8799. By Vidhin Mehta (OpenERP)
-
[MERGE]Trunk.
- 8798. By Vidhin Mehta (OpenERP)
-
[IMP]Change condition in crm_lead def stage_modify
- 8797. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8796. By Vidhin Mehta (OpenERP)
-
[Imp]
- 8795. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8794. By Vidhin Mehta (OpenERP)
-
[IMP]
- 8793. By Vidhin Mehta (OpenERP)
-
[IMP]FIX
- 8792. By Vidhin Mehta (OpenERP)
-
[IMP]
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'crm/crm.py' |
2 | --- crm/crm.py 2013-07-16 15:15:13 +0000 |
3 | +++ crm/crm.py 2013-08-13 11:44:00 +0000 |
4 | @@ -84,7 +84,63 @@ |
5 | 'type': 'both', |
6 | 'case_default': True, |
7 | } |
8 | + def create(self, cr, uid, value, context=None): |
9 | + if context is None: context = {} |
10 | + stage_id = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1) |
11 | + section_id = context.get('default_section_id', False) |
12 | + if section_id and stage_id: |
13 | + create_return = self._stage_modify(cr, uid, stage_id[0], section_id, value, context=context) |
14 | + return create_return.get('id') |
15 | + |
16 | + create_return = super(crm_case_stage, self).create(cr, uid, value, context=context) |
17 | + if section_id: |
18 | + self.pool.get('crm.case.section').write(cr ,uid, section_id, {'stage_ids': [(4, create_return)]}, context=context) |
19 | + return create_return |
20 | + |
21 | + def _stage_modify(self, cr, uid, stage_id, section_id, value, context=None): |
22 | + crm_lead = self.pool.get('crm.lead') |
23 | + section_browse = self.pool.get('crm.case.section').browse(cr, uid, section_id, context=context) |
24 | + crm_lead_ids = crm_lead.search(cr, uid, [('stage_id','=', stage_id),('section_id','=', section_id)], context=context) |
25 | + stage_ids = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1) |
26 | + |
27 | + if not stage_ids: |
28 | + value['state'] = self.browse(cr, uid, stage_id, context=context).state |
29 | + value['section_ids'] = [(6, 0, [section_id])] |
30 | + new_stage_id = self.copy(cr, uid, stage_id, default=value, context=context) |
31 | + else: |
32 | + new_stage_id = stage_ids[0] |
33 | + |
34 | + if new_stage_id: |
35 | + section_write = section_browse.write({'stage_ids': [(3, stage_id),(4, new_stage_id)]}, context=context) |
36 | + crm_write = crm_lead.write(cr, uid, crm_lead_ids, {'stage_id': new_stage_id} , context=context) |
37 | + if section_write and crm_write: |
38 | + return {'boolean':True, 'id': new_stage_id} |
39 | + return {'boolean': False, 'id' : Null} |
40 | |
41 | + def write(self, cr, uid, ids, value, context=None): |
42 | + if context is None: context = {} |
43 | + section_id = context.get('default_section_id', False) |
44 | + if value.get('name') and section_id: |
45 | + for stage_id in ids: |
46 | + write_return = self._stage_modify(cr, uid, stage_id, section_id, value, context=context) |
47 | + if not write_return.get('boolean'): |
48 | + return False |
49 | + return True |
50 | + return super(crm_case_stage, self).write(cr, uid, ids, value, context=context) |
51 | + |
52 | + def unlink(self, cr, uid, ids, context=None): |
53 | + if context is None: context = {} |
54 | + section_id = context.get('default_section_id', False) |
55 | + if section_id: |
56 | + crm_lead = self.pool.get('crm.lead') |
57 | + for stage_id in ids: |
58 | + crm_lead_ids = crm_lead.search(cr, uid, [('stage_id','=',stage_id),('section_id','=', section_id)]) |
59 | + crm_write = crm_lead.write(cr, uid, crm_lead_ids, {'stage_id': False} , context=context) |
60 | + section_write = self.pool.get('crm.case.section').write(cr, uid, section_id, {'stage_ids': [(3, stage_id)]}, context=context) |
61 | + if not crm_write or not section_write: |
62 | + return False |
63 | + return True |
64 | + return super(crm_case_stage,self).unlink(cr, uid, ids, context) |
65 | |
66 | class crm_case_section(osv.osv): |
67 | """ Model for sales teams. """ |
68 | |
69 | === modified file 'crm/crm_lead.py' |
70 | --- crm/crm_lead.py 2013-08-05 14:19:05 +0000 |
71 | +++ crm/crm_lead.py 2013-08-13 11:44:00 +0000 |
72 | @@ -365,7 +365,7 @@ |
73 | # OR all section_ids and OR with case_default |
74 | search_domain = [] |
75 | if section_ids: |
76 | - search_domain += [('|')] * len(section_ids) |
77 | + search_domain += [('&')] * len(section_ids) |
78 | for section_id in section_ids: |
79 | search_domain.append(('section_ids', '=', section_id)) |
80 | search_domain.append(('case_default', '=', True)) |
81 | |
82 | === modified file 'crm/crm_lead_view.xml' |
83 | --- crm/crm_lead_view.xml 2013-08-09 07:52:28 +0000 |
84 | +++ crm/crm_lead_view.xml 2013-08-13 11:44:00 +0000 |
85 | @@ -543,7 +543,7 @@ |
86 | <search string="Search Opportunities"> |
87 | <field name="name" string="Opportunity" filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/> |
88 | <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/> |
89 | - <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> |
90 | + <field name="section_id" groups="base.group_multi_salesteams"/> |
91 | <field name="user_id"/> |
92 | <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/> |
93 | <field name="stage_id" domain="[]"/> |
94 | |
95 | === modified file 'hr/hr_demo.xml' |
96 | --- hr/hr_demo.xml 2013-04-11 12:44:46 +0000 |
97 | +++ hr/hr_demo.xml 2013-08-13 11:44:00 +0000 |
98 | @@ -25,7 +25,7 @@ |
99 | <record id="dep_sales" model="hr.department"> |
100 | <field name="name">Sales</field> |
101 | </record> |
102 | - |
103 | + |
104 | <!--Jobs--> |
105 | |
106 | <record id="job_ceo" model="hr.job"> |
107 | |
108 | === modified file 'hr/hr_view.xml' |
109 | --- hr/hr_view.xml 2013-06-21 11:03:44 +0000 |
110 | +++ hr/hr_view.xml 2013-08-13 11:44:00 +0000 |
111 | @@ -343,6 +343,8 @@ |
112 | <field name="state" widget="statusbar" statusbar_visible="recruit,open"/> |
113 | </header> |
114 | <sheet> |
115 | + <div name="hr_applicant_button" class="oe_right oe_button_box"> |
116 | + </div> |
117 | <div class="oe_title"> |
118 | <label for="name" class="oe_edit_only"/> |
119 | <h1><field name="name" class="oe_inline"/></h1> |
120 | |
121 | === modified file 'hr_recruitment/hr_recruitment.py' |
122 | --- hr_recruitment/hr_recruitment.py 2013-07-24 07:22:13 +0000 |
123 | +++ hr_recruitment/hr_recruitment.py 2013-08-13 11:44:00 +0000 |
124 | @@ -44,7 +44,7 @@ |
125 | } |
126 | |
127 | class hr_recruitment_stage(osv.osv): |
128 | - """ Stage of HR Recruitment """ |
129 | + """ Stage of HR Recruitment """ |
130 | _name = "hr.recruitment.stage" |
131 | _description = "Stage of Recruitment" |
132 | _order = 'sequence' |
133 | @@ -54,12 +54,83 @@ |
134 | 'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep this field empty."), |
135 | '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."), |
136 | 'requirements': fields.text('Requirements'), |
137 | + 'case_default': fields.boolean('Default to New Job'), |
138 | } |
139 | + |
140 | + def _get_default_job_id(self, cr, uid, ctx={}): |
141 | + job = ctx.get('default_job_id', False) |
142 | + if type(job) is int: |
143 | + return [job] |
144 | + return job |
145 | + |
146 | _defaults = { |
147 | 'sequence': 1, |
148 | 'fold': False, |
149 | + 'job_ids': _get_default_job_id, |
150 | + 'case_default': True |
151 | } |
152 | |
153 | + def _stage_modify(self, cr, uid, stage_id, job_id, vals, context=None): |
154 | + hr_applicant = self.pool.get('hr.applicant') |
155 | + hr_job = self.pool.get('hr.job').browse(cr, uid, job_id, context=context) |
156 | + hr_applicant_ids = hr_applicant.search(cr, uid, [('stage_id','=', stage_id),('job_id','=', job_id)], context=context) |
157 | + stage_ids = self.search(cr, uid, [('name','=', vals['name'])], context=context) |
158 | + if not stage_ids: |
159 | + vals['state'] = self.browse(cr, uid, stage_id, context=context).state |
160 | + vals['job_ids'] = [(6, 0, [job_id])] |
161 | + new_stage_id = self.copy(cr, uid, stage_id, default=vals, context=context) |
162 | + else: |
163 | + new_stage_id = stage_ids[0] |
164 | + |
165 | + if new_stage_id: |
166 | + hr_job_write = hr_job.write({'stage_ids': [(4, new_stage_id),(3, stage_id)]}, context=context) |
167 | + hr_applicant_write = hr_applicant.write(cr, uid, hr_applicant_ids, {'stage_id': new_stage_id} , context=context) |
168 | + if hr_job_write and hr_applicant_write: |
169 | + return {'boolean': True,'id': new_stage_id} |
170 | + return {'boolean': False,'id': Null} |
171 | + |
172 | + def create(self, cr, uid, vals, context=None): |
173 | + if context is None: |
174 | + context = {} |
175 | + stage_ids = self.search(cr, uid, [('name','=', vals.get('name'))], context=context, limit=1) |
176 | + job_id = context.get('default_job_id') |
177 | + |
178 | + if job_id and stage_ids: |
179 | + create_return = self._stage_modify(cr, uid, stage_ids[0], job_id, vals, context=context) |
180 | + return create_return.get('id') |
181 | + |
182 | + create_return = super(hr_recruitment_stage, self).create(cr, uid, vals, context=context) |
183 | + if job_id: |
184 | + self.pool.get('hr.job').write(cr, uid, job_id, {'stage_ids': [(4, create_return)]}, context=context) |
185 | + return create_return |
186 | + |
187 | + def write(self, cr, uid, ids, vals, context=None): |
188 | + if context is None: |
189 | + context = {} |
190 | + job_id = context.get('default_job_id') |
191 | + if vals.get('name') and job_id: |
192 | + for stage_id in ids: |
193 | + write_return = self._stage_modify(cr, uid, stage_id, job_id, vals, context=context) |
194 | + if not write_return.get('boolean'): |
195 | + return False |
196 | + return True |
197 | + return super(hr_recruitment_stage, self).write(cr, uid, ids, vals, context=context) |
198 | + |
199 | + def unlink(self, cr, uid, ids, context=None): |
200 | + if context is None: |
201 | + context = {} |
202 | + job_id = context.get('default_job_id', False) |
203 | + if job_id: |
204 | + hr_application = self.pool.get('hr.applicant') |
205 | + for stage_id in ids: |
206 | + applicant_ids = hr_application.search(cr, uid, [('stage_id','=',stage_id),('job_id','=',job_id)]) |
207 | + hr_app_write = hr_application.write(cr, uid, applicant_ids, {'stage_id': False} , context=context) |
208 | + hr_job_write = self.pool.get('hr.job').write(cr, uid, job_id, {'stage_ids': [(3, stage_id)]}, context=context) |
209 | + if not hr_app_write or not hr_job_write: |
210 | + return False |
211 | + return True |
212 | + return super(hr_recruitment_stage,self).unlink(cr, uid, ids, context) |
213 | + |
214 | class hr_recruitment_degree(osv.osv): |
215 | """ Degree of HR Recruitment """ |
216 | _name = "hr.recruitment.degree" |
217 | @@ -87,29 +158,29 @@ |
218 | }, |
219 | } |
220 | |
221 | - def _get_default_department_id(self, cr, uid, context=None): |
222 | + def _get_default_job_id(self, cr, uid, context=None): |
223 | """ Gives default department by checking if present in the context """ |
224 | - return (self._resolve_department_id_from_context(cr, uid, context=context) or False) |
225 | + return (self._resolve_job_id_from_context(cr, uid, context=context) or False) |
226 | |
227 | def _get_default_stage_id(self, cr, uid, context=None): |
228 | """ Gives default stage_id """ |
229 | department_id = self._get_default_department_id(cr, uid, context=context) |
230 | return self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], context=context) |
231 | |
232 | - def _resolve_department_id_from_context(self, cr, uid, context=None): |
233 | - """ Returns ID of department based on the value of 'default_department_id' |
234 | + def _resolve_job_id_from_context(self, cr, uid, context=None): |
235 | + """ Returns ID of job based on the value of 'default_job_id' |
236 | context key, or None if it cannot be resolved to a single |
237 | department. |
238 | """ |
239 | if context is None: |
240 | context = {} |
241 | - if type(context.get('default_department_id')) in (int, long): |
242 | - return context.get('default_department_id') |
243 | - if isinstance(context.get('default_department_id'), basestring): |
244 | - department_name = context['default_department_id'] |
245 | - department_ids = self.pool.get('hr.department').name_search(cr, uid, name=department_name, context=context) |
246 | - if len(department_ids) == 1: |
247 | - return int(department_ids[0][0]) |
248 | + if type(context.get('default_job_id')) in (int, long): |
249 | + return context.get('default_job_id') |
250 | + if isinstance(context.get('default_job_id'), basestring): |
251 | + job_name = context['default_job_id'] |
252 | + job_ids = self.pool.get('hr.job').name_search(cr, uid, name=job_name, context=context) |
253 | + if len(job_ids) == 1: |
254 | + return int(job_ids[0][0]) |
255 | return None |
256 | |
257 | def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): |
258 | @@ -121,13 +192,14 @@ |
259 | order = "%s desc" % order |
260 | # retrieve section_id from the context and write the domain |
261 | # - ('id', 'in', 'ids'): add columns that should be present |
262 | - # - OR ('department_id', '=', False), ('fold', '=', False): add default columns that are not folded |
263 | - # - OR ('department_id', 'in', department_id), ('fold', '=', False) if department_id: add department columns that are not folded |
264 | - department_id = self._resolve_department_id_from_context(cr, uid, context=context) |
265 | + # - OR ('job_id', '=', False), ('fold', '=', False): add default columns that are not folded |
266 | + # - OR ('job_id', 'in', job_id), ('fold', '=', False) if job_id: add department columns that are not folded |
267 | + job_id = self._resolve_job_id_from_context(cr, uid, context=context) |
268 | search_domain = [] |
269 | - if department_id: |
270 | - search_domain += ['|', ('department_id', '=', department_id)] |
271 | - search_domain += ['|', ('id', 'in', ids), ('department_id', '=', False)] |
272 | + if job_id: |
273 | + search_domain += ['|', ('job_ids', '=', job_id)] |
274 | + search_domain += [('id', 'in', ids)] |
275 | + search_domain += ['|', '|', ('id', 'in', ids), ('job_ids', '=', False), ('case_default', '=', True)] |
276 | stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) |
277 | result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) |
278 | # restore order of the search |
279 | @@ -220,7 +292,7 @@ |
280 | 'active': lambda *a: 1, |
281 | 'user_id': lambda s, cr, uid, c: uid, |
282 | 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), |
283 | - 'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c), |
284 | + 'job_id': lambda s, cr, uid, c: s._get_default_job_id(cr, uid, c), |
285 | 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c), |
286 | 'color': 0, |
287 | 'date_last_stage_update': fields.datetime.now(), |
288 | @@ -262,17 +334,16 @@ |
289 | if isinstance(cases, (int, long)): |
290 | cases = self.browse(cr, uid, cases, context=context) |
291 | # collect all section_ids |
292 | - department_ids = [] |
293 | + job_ids = [] |
294 | if section_id: |
295 | - department_ids.append(section_id) |
296 | + job_ids.append(section_id) |
297 | for case in cases: |
298 | - if case.department_id: |
299 | - department_ids.append(case.department_id.id) |
300 | + if case.job_id: |
301 | + job_ids.append(case.job_id.id) |
302 | # OR all section_ids and OR with case_default |
303 | search_domain = [] |
304 | - if department_ids: |
305 | - search_domain += ['|', ('department_id', 'in', department_ids)] |
306 | - search_domain.append(('department_id', '=', False)) |
307 | + if job_ids: |
308 | + search_domain += [('job_ids', 'in', job_ids)] |
309 | # AND with the domain in parameter |
310 | search_domain += list(domain) |
311 | # perform search, return the first found |
312 | @@ -463,8 +534,18 @@ |
313 | 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, |
314 | help="Email alias for this job position. New emails will automatically " |
315 | "create new applicants for this job position."), |
316 | + 'stage_ids':fields.many2many('hr.recruitment.stage', 'job_stage_rel','job_id', 'stage_id', 'Stages') |
317 | } |
318 | |
319 | + def _get_stage_common(self, cr, uid, context): |
320 | + ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [('case_default','=',1)], context=context) |
321 | + return ids |
322 | + |
323 | + _defaults = { |
324 | + 'alias_domain': False, # always hide alias during creation |
325 | + 'stage_ids': _get_stage_common, |
326 | + } |
327 | + |
328 | def _auto_init(self, cr, context=None): |
329 | """Installation hook to create aliases for all jobs and avoid constraint errors.""" |
330 | return self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job, self)._auto_init, |
331 | |
332 | === modified file 'hr_recruitment/hr_recruitment_demo.xml' |
333 | --- hr_recruitment/hr_recruitment_demo.xml 2013-03-13 09:37:09 +0000 |
334 | +++ hr_recruitment/hr_recruitment_demo.xml 2013-08-13 11:44:00 +0000 |
335 | @@ -124,6 +124,35 @@ |
336 | |
337 | <record id="hr.job_developer" model="hr.job"> |
338 | <field name="survey_id" ref="survey_job_0"/> |
339 | - </record> |
340 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" /> |
341 | + </record> |
342 | + <record id="hr.job_ceo" model="hr.job"> |
343 | + <field name="survey_id" ref="survey_job_0"/> |
344 | + <field name= "stage_ids" eval="[(4, stage_job3),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" /> |
345 | + </record> |
346 | + <record id="hr.job_cto" model="hr.job"> |
347 | + <field name="survey_id" ref="survey_job_0"/> |
348 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" /> |
349 | + </record> |
350 | + <record id="hr.job_hrm" model="hr.job"> |
351 | + <field name="survey_id" ref="survey_job_0"/> |
352 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" /> |
353 | + </record> |
354 | + <record id="hr.job_consultant" model="hr.job"> |
355 | + <field name="survey_id" ref="survey_job_0"/> |
356 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" /> |
357 | + </record> |
358 | + |
359 | + <record id="hr.job_marketing" model="hr.job"> |
360 | + <field name="survey_id" ref="survey_job_0"/> |
361 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" /> |
362 | + </record> |
363 | + |
364 | + <record id="hr.job_trainee" model="hr.job"> |
365 | + <field name="survey_id" ref="survey_job_0"/> |
366 | + <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" /> |
367 | + </record> |
368 | + |
369 | + |
370 | </data> |
371 | </openerp> |
372 | \ No newline at end of file |
373 | |
374 | === modified file 'hr_recruitment/hr_recruitment_menu.xml' |
375 | --- hr_recruitment/hr_recruitment_menu.xml 2013-03-04 15:13:55 +0000 |
376 | +++ hr_recruitment/hr_recruitment_menu.xml 2013-08-13 11:44:00 +0000 |
377 | @@ -63,7 +63,24 @@ |
378 | id="menu_crm_case_categ0_act_job" action="crm_case_categ0_act_job" sequence="1"/> |
379 | |
380 | <menuitem parent="hr.menu_hr_configuration" id="hr.menu_hr_job" action="hr.action_hr_job" sequence="2"/> |
381 | - |
382 | + |
383 | + <!-- Add new Button(Application) in department Form --> |
384 | + |
385 | + <record id="view_job_form_inherit" model="ir.ui.view"> |
386 | + <field name="name">hr.job.form.inherit</field> |
387 | + <field name="model">hr.job</field> |
388 | + <field name="inherit_id" ref="hr.view_hr_job_form"/> |
389 | + <field name="arch" type="xml"> |
390 | + <xpath expr="//div[@name='hr_applicant_button']" position="inside"> |
391 | + <button name="%(crm_case_categ0_act_job)d" string="Applications" type="action" |
392 | + context="{'search_default_job_id': active_id, 'default_job_id': active_id}"/> |
393 | + </xpath> |
394 | + <xpath expr="//field[@name='requirements']" position="after"> |
395 | + <separator string="Recruitment Stages" /> |
396 | + <field name="stage_ids" nolabel="1"/> |
397 | + </xpath> |
398 | + </field> |
399 | + </record> |
400 | |
401 | </data> |
402 | </openerp> |
403 | |
404 | === modified file 'hr_recruitment/hr_recruitment_view.xml' |
405 | --- hr_recruitment/hr_recruitment_view.xml 2013-07-16 15:15:13 +0000 |
406 | +++ hr_recruitment/hr_recruitment_view.xml 2013-08-13 11:44:00 +0000 |
407 | @@ -354,15 +354,17 @@ |
408 | <group string="Stage Definition"> |
409 | <group> |
410 | <field name="name"/> |
411 | + <field name="fold"/> |
412 | + <field name="case_default"/> |
413 | <field name="department_id"/> |
414 | </group> |
415 | <group> |
416 | <field name="sequence"/> |
417 | - <field name="fold"/> |
418 | </group> |
419 | </group> |
420 | <separator string="Requirements"/> |
421 | <field name="requirements"/> |
422 | + <field name="job_ids" invisible="1"/> |
423 | </sheet> |
424 | </form> |
425 | </field> |
426 | |
427 | === modified file 'project/project.py' |
428 | --- project/project.py 2013-07-24 07:22:13 +0000 |
429 | +++ project/project.py 2013-08-13 11:44:00 +0000 |
430 | @@ -52,6 +52,59 @@ |
431 | 'project_ids': lambda self, cr, uid, ctx=None: self.pool['project.task']._get_default_project_id(cr, uid, context=ctx), |
432 | } |
433 | _order = 'sequence' |
434 | + def write(self, cr, uid, ids, value, context=None): |
435 | + if context is None:context = {} |
436 | + project_id = context.get('default_project_id', False) |
437 | + if value.get('name') and project_id: |
438 | + for id in ids: |
439 | + write_return = self._stage_modify(cr, uid, id, project_id, value, context=context) |
440 | + if not write_return.get('boolean'): |
441 | + return False |
442 | + return True |
443 | + return super(project_task_type, self).write(cr, uid, ids, value, context=context) |
444 | + |
445 | + def _stage_modify(self, cr, uid, stage_id, project_id, vals, context=None): |
446 | + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) |
447 | + project_task = self.pool.get('project.task') |
448 | + stage_ids = self.search(cr, uid, [('name','=', vals.get('name'))], context=context, limit=1) |
449 | + task_ids = project_task.search(cr, uid, [('stage_id','=', stage_id),('project_id','=', project_id)], context=context) |
450 | + |
451 | + if not stage_ids: |
452 | + vals['state'] = self.browse(cr, uid, stage_id, context=context).state |
453 | + vals['project_ids'] = [(6, 0, [project_id])] |
454 | + new_stage_id = self.copy(cr, uid, stage_id, default=vals, context=context) |
455 | + else: |
456 | + new_stage_id = stage_ids[0] |
457 | + |
458 | + if new_stage_id: |
459 | + project_write = project.write({'type_ids': [(3, stage_id),(4, new_stage_id),]}, context=context) |
460 | + task_write = project_task.write(cr, uid, task_ids, {'stage_id': new_stage_id} , context=context) |
461 | + if project_write and task_write: |
462 | + return {'boolean':True, 'id': new_stage_id} |
463 | + return {'boolean': False, 'id': Null} |
464 | + |
465 | + def create(self, cr, uid, value, context=None): |
466 | + if context is None:context = {} |
467 | + stage_id = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1) |
468 | + project_id = context.get('default_project_id', False) |
469 | + if project_id and stage_id: |
470 | + create_return = self._stage_modify(cr, uid, stage_id[0], project_id, value, context=context) |
471 | + return create_return.get('id') |
472 | + return super(project_task_type, self).create(cr, uid, value, context=context) |
473 | + |
474 | + def unlink(self, cr, uid, ids, context=None): |
475 | + if context is None: context = {} |
476 | + project_id = context.get('default_project_id') |
477 | + if project_id: |
478 | + project_task = self.pool.get('project.task') |
479 | + for stage_id in ids: |
480 | + task_ids = project_task.search(cr, uid, [('stage_id','=', stage_id),('project_id','=', project_id)]) |
481 | + task_write = project_task.write(cr, uid, task_ids, {'stage_id': False} , context=context) |
482 | + project_write = self.pool.get('project.project').write({'type_ids': [cr, uid, project_id, (3, stage_id)]}, context=context) |
483 | + if not project_write or not task_write: |
484 | + return False |
485 | + return True |
486 | + return super(project_task_type,self).unlink(cr, uid, ids, context) |
487 | |
488 | |
489 | class project(osv.osv): |
490 | |
491 | === modified file 'project/security/ir.model.access.csv' |
492 | --- project/security/ir.model.access.csv 2013-07-10 10:15:08 +0000 |
493 | +++ project/security/ir.model.access.csv 2013-08-13 11:44:00 +0000 |
494 | @@ -3,7 +3,8 @@ |
495 | access_project_project_manager,project.project,model_project_project,project.group_project_manager,1,1,1,1 |
496 | access_account_analytic_account_user,account.analytic.account,analytic.model_account_analytic_account,project.group_project_user,1,0,0,0 |
497 | access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,project.group_project_manager,1,1,1,1 |
498 | -access_project_task_type_user,project.task.type user,model_project_task_type,project.group_project_user,1,1,1,1 |
499 | +access_project_task_type_manager,project.task.type manager,model_project_task_type,project.group_project_manager,1,1,1,1 |
500 | +access_project_task_type_user,project.task.type user,model_project_task_type,project.group_project_user,1,0,0,0 |
501 | access_project_task,project.task,model_project_task,project.group_project_user,1,1,1,1 |
502 | access_project_task_work,project.task.work,model_project_task_work,project.group_project_user,1,1,1,1 |
503 | access_report_project_task_user,report.project.task.user,model_report_project_task_user,project.group_project_manager,1,1,1,1 |