Merge lp:~openerp-dev/openobject-addons/trunk-kanban-column-vme into lp:openobject-addons

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
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+171049@code.launchpad.net
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
=== modified file 'crm/crm.py'
--- crm/crm.py 2013-07-16 15:15:13 +0000
+++ crm/crm.py 2013-08-13 11:44:00 +0000
@@ -84,7 +84,63 @@
84 'type': 'both',84 'type': 'both',
85 'case_default': True,85 'case_default': True,
86 }86 }
87 def create(self, cr, uid, value, context=None):
88 if context is None: context = {}
89 stage_id = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1)
90 section_id = context.get('default_section_id', False)
91 if section_id and stage_id:
92 create_return = self._stage_modify(cr, uid, stage_id[0], section_id, value, context=context)
93 return create_return.get('id')
94
95 create_return = super(crm_case_stage, self).create(cr, uid, value, context=context)
96 if section_id:
97 self.pool.get('crm.case.section').write(cr ,uid, section_id, {'stage_ids': [(4, create_return)]}, context=context)
98 return create_return
99
100 def _stage_modify(self, cr, uid, stage_id, section_id, value, context=None):
101 crm_lead = self.pool.get('crm.lead')
102 section_browse = self.pool.get('crm.case.section').browse(cr, uid, section_id, context=context)
103 crm_lead_ids = crm_lead.search(cr, uid, [('stage_id','=', stage_id),('section_id','=', section_id)], context=context)
104 stage_ids = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1)
105
106 if not stage_ids:
107 value['state'] = self.browse(cr, uid, stage_id, context=context).state
108 value['section_ids'] = [(6, 0, [section_id])]
109 new_stage_id = self.copy(cr, uid, stage_id, default=value, context=context)
110 else:
111 new_stage_id = stage_ids[0]
112
113 if new_stage_id:
114 section_write = section_browse.write({'stage_ids': [(3, stage_id),(4, new_stage_id)]}, context=context)
115 crm_write = crm_lead.write(cr, uid, crm_lead_ids, {'stage_id': new_stage_id} , context=context)
116 if section_write and crm_write:
117 return {'boolean':True, 'id': new_stage_id}
118 return {'boolean': False, 'id' : Null}
87119
120 def write(self, cr, uid, ids, value, context=None):
121 if context is None: context = {}
122 section_id = context.get('default_section_id', False)
123 if value.get('name') and section_id:
124 for stage_id in ids:
125 write_return = self._stage_modify(cr, uid, stage_id, section_id, value, context=context)
126 if not write_return.get('boolean'):
127 return False
128 return True
129 return super(crm_case_stage, self).write(cr, uid, ids, value, context=context)
130
131 def unlink(self, cr, uid, ids, context=None):
132 if context is None: context = {}
133 section_id = context.get('default_section_id', False)
134 if section_id:
135 crm_lead = self.pool.get('crm.lead')
136 for stage_id in ids:
137 crm_lead_ids = crm_lead.search(cr, uid, [('stage_id','=',stage_id),('section_id','=', section_id)])
138 crm_write = crm_lead.write(cr, uid, crm_lead_ids, {'stage_id': False} , context=context)
139 section_write = self.pool.get('crm.case.section').write(cr, uid, section_id, {'stage_ids': [(3, stage_id)]}, context=context)
140 if not crm_write or not section_write:
141 return False
142 return True
143 return super(crm_case_stage,self).unlink(cr, uid, ids, context)
88144
89class crm_case_section(osv.osv):145class crm_case_section(osv.osv):
90 """ Model for sales teams. """146 """ Model for sales teams. """
91147
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py 2013-08-05 14:19:05 +0000
+++ crm/crm_lead.py 2013-08-13 11:44:00 +0000
@@ -365,7 +365,7 @@
365 # OR all section_ids and OR with case_default365 # OR all section_ids and OR with case_default
366 search_domain = []366 search_domain = []
367 if section_ids:367 if section_ids:
368 search_domain += [('|')] * len(section_ids)368 search_domain += [('&')] * len(section_ids)
369 for section_id in section_ids:369 for section_id in section_ids:
370 search_domain.append(('section_ids', '=', section_id))370 search_domain.append(('section_ids', '=', section_id))
371 search_domain.append(('case_default', '=', True))371 search_domain.append(('case_default', '=', True))
372372
=== modified file 'crm/crm_lead_view.xml'
--- crm/crm_lead_view.xml 2013-08-09 07:52:28 +0000
+++ crm/crm_lead_view.xml 2013-08-13 11:44:00 +0000
@@ -543,7 +543,7 @@
543 <search string="Search Opportunities">543 <search string="Search Opportunities">
544 <field name="name" string="Opportunity" filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>544 <field name="name" string="Opportunity" filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
545 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>545 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
546 <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>546 <field name="section_id" groups="base.group_multi_salesteams"/>
547 <field name="user_id"/>547 <field name="user_id"/>
548 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>548 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
549 <field name="stage_id" domain="[]"/>549 <field name="stage_id" domain="[]"/>
550550
=== modified file 'hr/hr_demo.xml'
--- hr/hr_demo.xml 2013-04-11 12:44:46 +0000
+++ hr/hr_demo.xml 2013-08-13 11:44:00 +0000
@@ -25,7 +25,7 @@
25 <record id="dep_sales" model="hr.department">25 <record id="dep_sales" model="hr.department">
26 <field name="name">Sales</field>26 <field name="name">Sales</field>
27 </record>27 </record>
2828
29 <!--Jobs-->29 <!--Jobs-->
3030
31 <record id="job_ceo" model="hr.job">31 <record id="job_ceo" model="hr.job">
3232
=== modified file 'hr/hr_view.xml'
--- hr/hr_view.xml 2013-06-21 11:03:44 +0000
+++ hr/hr_view.xml 2013-08-13 11:44:00 +0000
@@ -343,6 +343,8 @@
343 <field name="state" widget="statusbar" statusbar_visible="recruit,open"/>343 <field name="state" widget="statusbar" statusbar_visible="recruit,open"/>
344 </header>344 </header>
345 <sheet>345 <sheet>
346 <div name="hr_applicant_button" class="oe_right oe_button_box">
347 </div>
346 <div class="oe_title">348 <div class="oe_title">
347 <label for="name" class="oe_edit_only"/>349 <label for="name" class="oe_edit_only"/>
348 <h1><field name="name" class="oe_inline"/></h1>350 <h1><field name="name" class="oe_inline"/></h1>
349351
=== modified file 'hr_recruitment/hr_recruitment.py'
--- hr_recruitment/hr_recruitment.py 2013-07-24 07:22:13 +0000
+++ hr_recruitment/hr_recruitment.py 2013-08-13 11:44:00 +0000
@@ -44,7 +44,7 @@
44 }44 }
4545
46class hr_recruitment_stage(osv.osv):46class hr_recruitment_stage(osv.osv):
47 """ Stage of HR Recruitment """47 """ Stage of HR Recruitment """
48 _name = "hr.recruitment.stage"48 _name = "hr.recruitment.stage"
49 _description = "Stage of Recruitment"49 _description = "Stage of Recruitment"
50 _order = 'sequence'50 _order = 'sequence'
@@ -54,12 +54,83 @@
54 '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."),54 '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."),
55 '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."),55 '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."),
56 'requirements': fields.text('Requirements'),56 'requirements': fields.text('Requirements'),
57 'case_default': fields.boolean('Default to New Job'),
57 }58 }
59
60 def _get_default_job_id(self, cr, uid, ctx={}):
61 job = ctx.get('default_job_id', False)
62 if type(job) is int:
63 return [job]
64 return job
65
58 _defaults = {66 _defaults = {
59 'sequence': 1,67 'sequence': 1,
60 'fold': False,68 'fold': False,
69 'job_ids': _get_default_job_id,
70 'case_default': True
61 }71 }
6272
73 def _stage_modify(self, cr, uid, stage_id, job_id, vals, context=None):
74 hr_applicant = self.pool.get('hr.applicant')
75 hr_job = self.pool.get('hr.job').browse(cr, uid, job_id, context=context)
76 hr_applicant_ids = hr_applicant.search(cr, uid, [('stage_id','=', stage_id),('job_id','=', job_id)], context=context)
77 stage_ids = self.search(cr, uid, [('name','=', vals['name'])], context=context)
78 if not stage_ids:
79 vals['state'] = self.browse(cr, uid, stage_id, context=context).state
80 vals['job_ids'] = [(6, 0, [job_id])]
81 new_stage_id = self.copy(cr, uid, stage_id, default=vals, context=context)
82 else:
83 new_stage_id = stage_ids[0]
84
85 if new_stage_id:
86 hr_job_write = hr_job.write({'stage_ids': [(4, new_stage_id),(3, stage_id)]}, context=context)
87 hr_applicant_write = hr_applicant.write(cr, uid, hr_applicant_ids, {'stage_id': new_stage_id} , context=context)
88 if hr_job_write and hr_applicant_write:
89 return {'boolean': True,'id': new_stage_id}
90 return {'boolean': False,'id': Null}
91
92 def create(self, cr, uid, vals, context=None):
93 if context is None:
94 context = {}
95 stage_ids = self.search(cr, uid, [('name','=', vals.get('name'))], context=context, limit=1)
96 job_id = context.get('default_job_id')
97
98 if job_id and stage_ids:
99 create_return = self._stage_modify(cr, uid, stage_ids[0], job_id, vals, context=context)
100 return create_return.get('id')
101
102 create_return = super(hr_recruitment_stage, self).create(cr, uid, vals, context=context)
103 if job_id:
104 self.pool.get('hr.job').write(cr, uid, job_id, {'stage_ids': [(4, create_return)]}, context=context)
105 return create_return
106
107 def write(self, cr, uid, ids, vals, context=None):
108 if context is None:
109 context = {}
110 job_id = context.get('default_job_id')
111 if vals.get('name') and job_id:
112 for stage_id in ids:
113 write_return = self._stage_modify(cr, uid, stage_id, job_id, vals, context=context)
114 if not write_return.get('boolean'):
115 return False
116 return True
117 return super(hr_recruitment_stage, self).write(cr, uid, ids, vals, context=context)
118
119 def unlink(self, cr, uid, ids, context=None):
120 if context is None:
121 context = {}
122 job_id = context.get('default_job_id', False)
123 if job_id:
124 hr_application = self.pool.get('hr.applicant')
125 for stage_id in ids:
126 applicant_ids = hr_application.search(cr, uid, [('stage_id','=',stage_id),('job_id','=',job_id)])
127 hr_app_write = hr_application.write(cr, uid, applicant_ids, {'stage_id': False} , context=context)
128 hr_job_write = self.pool.get('hr.job').write(cr, uid, job_id, {'stage_ids': [(3, stage_id)]}, context=context)
129 if not hr_app_write or not hr_job_write:
130 return False
131 return True
132 return super(hr_recruitment_stage,self).unlink(cr, uid, ids, context)
133
63class hr_recruitment_degree(osv.osv):134class hr_recruitment_degree(osv.osv):
64 """ Degree of HR Recruitment """135 """ Degree of HR Recruitment """
65 _name = "hr.recruitment.degree"136 _name = "hr.recruitment.degree"
@@ -87,29 +158,29 @@
87 },158 },
88 }159 }
89160
90 def _get_default_department_id(self, cr, uid, context=None):161 def _get_default_job_id(self, cr, uid, context=None):
91 """ Gives default department by checking if present in the context """162 """ Gives default department by checking if present in the context """
92 return (self._resolve_department_id_from_context(cr, uid, context=context) or False)163 return (self._resolve_job_id_from_context(cr, uid, context=context) or False)
93164
94 def _get_default_stage_id(self, cr, uid, context=None):165 def _get_default_stage_id(self, cr, uid, context=None):
95 """ Gives default stage_id """166 """ Gives default stage_id """
96 department_id = self._get_default_department_id(cr, uid, context=context)167 department_id = self._get_default_department_id(cr, uid, context=context)
97 return self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], context=context)168 return self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], context=context)
98169
99 def _resolve_department_id_from_context(self, cr, uid, context=None):170 def _resolve_job_id_from_context(self, cr, uid, context=None):
100 """ Returns ID of department based on the value of 'default_department_id'171 """ Returns ID of job based on the value of 'default_job_id'
101 context key, or None if it cannot be resolved to a single172 context key, or None if it cannot be resolved to a single
102 department.173 department.
103 """174 """
104 if context is None:175 if context is None:
105 context = {}176 context = {}
106 if type(context.get('default_department_id')) in (int, long):177 if type(context.get('default_job_id')) in (int, long):
107 return context.get('default_department_id')178 return context.get('default_job_id')
108 if isinstance(context.get('default_department_id'), basestring):179 if isinstance(context.get('default_job_id'), basestring):
109 department_name = context['default_department_id']180 job_name = context['default_job_id']
110 department_ids = self.pool.get('hr.department').name_search(cr, uid, name=department_name, context=context)181 job_ids = self.pool.get('hr.job').name_search(cr, uid, name=job_name, context=context)
111 if len(department_ids) == 1:182 if len(job_ids) == 1:
112 return int(department_ids[0][0])183 return int(job_ids[0][0])
113 return None184 return None
114185
115 def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):186 def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
@@ -121,13 +192,14 @@
121 order = "%s desc" % order192 order = "%s desc" % order
122 # retrieve section_id from the context and write the domain193 # retrieve section_id from the context and write the domain
123 # - ('id', 'in', 'ids'): add columns that should be present194 # - ('id', 'in', 'ids'): add columns that should be present
124 # - OR ('department_id', '=', False), ('fold', '=', False): add default columns that are not folded195 # - OR ('job_id', '=', False), ('fold', '=', False): add default columns that are not folded
125 # - OR ('department_id', 'in', department_id), ('fold', '=', False) if department_id: add department columns that are not folded196 # - OR ('job_id', 'in', job_id), ('fold', '=', False) if job_id: add department columns that are not folded
126 department_id = self._resolve_department_id_from_context(cr, uid, context=context)197 job_id = self._resolve_job_id_from_context(cr, uid, context=context)
127 search_domain = []198 search_domain = []
128 if department_id:199 if job_id:
129 search_domain += ['|', ('department_id', '=', department_id)]200 search_domain += ['|', ('job_ids', '=', job_id)]
130 search_domain += ['|', ('id', 'in', ids), ('department_id', '=', False)]201 search_domain += [('id', 'in', ids)]
202 search_domain += ['|', '|', ('id', 'in', ids), ('job_ids', '=', False), ('case_default', '=', True)]
131 stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context)203 stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context)
132 result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context)204 result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context)
133 # restore order of the search205 # restore order of the search
@@ -220,7 +292,7 @@
220 'active': lambda *a: 1,292 'active': lambda *a: 1,
221 'user_id': lambda s, cr, uid, c: uid,293 'user_id': lambda s, cr, uid, c: uid,
222 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),294 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
223 'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),295 'job_id': lambda s, cr, uid, c: s._get_default_job_id(cr, uid, c),
224 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),296 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),
225 'color': 0,297 'color': 0,
226 'date_last_stage_update': fields.datetime.now(),298 'date_last_stage_update': fields.datetime.now(),
@@ -262,17 +334,16 @@
262 if isinstance(cases, (int, long)):334 if isinstance(cases, (int, long)):
263 cases = self.browse(cr, uid, cases, context=context)335 cases = self.browse(cr, uid, cases, context=context)
264 # collect all section_ids336 # collect all section_ids
265 department_ids = []337 job_ids = []
266 if section_id:338 if section_id:
267 department_ids.append(section_id)339 job_ids.append(section_id)
268 for case in cases:340 for case in cases:
269 if case.department_id:341 if case.job_id:
270 department_ids.append(case.department_id.id)342 job_ids.append(case.job_id.id)
271 # OR all section_ids and OR with case_default343 # OR all section_ids and OR with case_default
272 search_domain = []344 search_domain = []
273 if department_ids:345 if job_ids:
274 search_domain += ['|', ('department_id', 'in', department_ids)]346 search_domain += [('job_ids', 'in', job_ids)]
275 search_domain.append(('department_id', '=', False))
276 # AND with the domain in parameter347 # AND with the domain in parameter
277 search_domain += list(domain)348 search_domain += list(domain)
278 # perform search, return the first found349 # perform search, return the first found
@@ -463,8 +534,18 @@
463 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,534 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
464 help="Email alias for this job position. New emails will automatically "535 help="Email alias for this job position. New emails will automatically "
465 "create new applicants for this job position."),536 "create new applicants for this job position."),
537 'stage_ids':fields.many2many('hr.recruitment.stage', 'job_stage_rel','job_id', 'stage_id', 'Stages')
466 }538 }
467539
540 def _get_stage_common(self, cr, uid, context):
541 ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [('case_default','=',1)], context=context)
542 return ids
543
544 _defaults = {
545 'alias_domain': False, # always hide alias during creation
546 'stage_ids': _get_stage_common,
547 }
548
468 def _auto_init(self, cr, context=None):549 def _auto_init(self, cr, context=None):
469 """Installation hook to create aliases for all jobs and avoid constraint errors."""550 """Installation hook to create aliases for all jobs and avoid constraint errors."""
470 return self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job, self)._auto_init,551 return self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job, self)._auto_init,
471552
=== modified file 'hr_recruitment/hr_recruitment_demo.xml'
--- hr_recruitment/hr_recruitment_demo.xml 2013-03-13 09:37:09 +0000
+++ hr_recruitment/hr_recruitment_demo.xml 2013-08-13 11:44:00 +0000
@@ -124,6 +124,35 @@
124124
125 <record id="hr.job_developer" model="hr.job">125 <record id="hr.job_developer" model="hr.job">
126 <field name="survey_id" ref="survey_job_0"/>126 <field name="survey_id" ref="survey_job_0"/>
127 </record>127 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" />
128 </record>
129 <record id="hr.job_ceo" model="hr.job">
130 <field name="survey_id" ref="survey_job_0"/>
131 <field name= "stage_ids" eval="[(4, stage_job3),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" />
132 </record>
133 <record id="hr.job_cto" model="hr.job">
134 <field name="survey_id" ref="survey_job_0"/>
135 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job4),(4, stage_job5),(4, stage_job6)]" />
136 </record>
137 <record id="hr.job_hrm" model="hr.job">
138 <field name="survey_id" ref="survey_job_0"/>
139 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" />
140 </record>
141 <record id="hr.job_consultant" model="hr.job">
142 <field name="survey_id" ref="survey_job_0"/>
143 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" />
144 </record>
145
146 <record id="hr.job_marketing" model="hr.job">
147 <field name="survey_id" ref="survey_job_0"/>
148 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" />
149 </record>
150
151 <record id="hr.job_trainee" model="hr.job">
152 <field name="survey_id" ref="survey_job_0"/>
153 <field name= "stage_ids" eval="[(4, stage_job1),(4, stage_job2),(4, stage_job3),(4, stage_job4)]" />
154 </record>
155
156
128 </data>157 </data>
129</openerp>158</openerp>
130\ No newline at end of file159\ No newline at end of file
131160
=== modified file 'hr_recruitment/hr_recruitment_menu.xml'
--- hr_recruitment/hr_recruitment_menu.xml 2013-03-04 15:13:55 +0000
+++ hr_recruitment/hr_recruitment_menu.xml 2013-08-13 11:44:00 +0000
@@ -63,7 +63,24 @@
63 id="menu_crm_case_categ0_act_job" action="crm_case_categ0_act_job" sequence="1"/>63 id="menu_crm_case_categ0_act_job" action="crm_case_categ0_act_job" sequence="1"/>
64 64
65 <menuitem parent="hr.menu_hr_configuration" id="hr.menu_hr_job" action="hr.action_hr_job" sequence="2"/>65 <menuitem parent="hr.menu_hr_configuration" id="hr.menu_hr_job" action="hr.action_hr_job" sequence="2"/>
6666
67 <!-- Add new Button(Application) in department Form -->
68
69 <record id="view_job_form_inherit" model="ir.ui.view">
70 <field name="name">hr.job.form.inherit</field>
71 <field name="model">hr.job</field>
72 <field name="inherit_id" ref="hr.view_hr_job_form"/>
73 <field name="arch" type="xml">
74 <xpath expr="//div[@name='hr_applicant_button']" position="inside">
75 <button name="%(crm_case_categ0_act_job)d" string="Applications" type="action"
76 context="{'search_default_job_id': active_id, 'default_job_id': active_id}"/>
77 </xpath>
78 <xpath expr="//field[@name='requirements']" position="after">
79 <separator string="Recruitment Stages" />
80 <field name="stage_ids" nolabel="1"/>
81 </xpath>
82 </field>
83 </record>
6784
68 </data>85 </data>
69</openerp>86</openerp>
7087
=== modified file 'hr_recruitment/hr_recruitment_view.xml'
--- hr_recruitment/hr_recruitment_view.xml 2013-07-16 15:15:13 +0000
+++ hr_recruitment/hr_recruitment_view.xml 2013-08-13 11:44:00 +0000
@@ -354,15 +354,17 @@
354 <group string="Stage Definition">354 <group string="Stage Definition">
355 <group>355 <group>
356 <field name="name"/>356 <field name="name"/>
357 <field name="fold"/>
358 <field name="case_default"/>
357 <field name="department_id"/>359 <field name="department_id"/>
358 </group>360 </group>
359 <group>361 <group>
360 <field name="sequence"/>362 <field name="sequence"/>
361 <field name="fold"/>
362 </group>363 </group>
363 </group>364 </group>
364 <separator string="Requirements"/>365 <separator string="Requirements"/>
365 <field name="requirements"/>366 <field name="requirements"/>
367 <field name="job_ids" invisible="1"/>
366 </sheet>368 </sheet>
367 </form>369 </form>
368 </field>370 </field>
369371
=== modified file 'project/project.py'
--- project/project.py 2013-07-24 07:22:13 +0000
+++ project/project.py 2013-08-13 11:44:00 +0000
@@ -52,6 +52,59 @@
52 'project_ids': lambda self, cr, uid, ctx=None: self.pool['project.task']._get_default_project_id(cr, uid, context=ctx),52 'project_ids': lambda self, cr, uid, ctx=None: self.pool['project.task']._get_default_project_id(cr, uid, context=ctx),
53 }53 }
54 _order = 'sequence'54 _order = 'sequence'
55 def write(self, cr, uid, ids, value, context=None):
56 if context is None:context = {}
57 project_id = context.get('default_project_id', False)
58 if value.get('name') and project_id:
59 for id in ids:
60 write_return = self._stage_modify(cr, uid, id, project_id, value, context=context)
61 if not write_return.get('boolean'):
62 return False
63 return True
64 return super(project_task_type, self).write(cr, uid, ids, value, context=context)
65
66 def _stage_modify(self, cr, uid, stage_id, project_id, vals, context=None):
67 project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
68 project_task = self.pool.get('project.task')
69 stage_ids = self.search(cr, uid, [('name','=', vals.get('name'))], context=context, limit=1)
70 task_ids = project_task.search(cr, uid, [('stage_id','=', stage_id),('project_id','=', project_id)], context=context)
71
72 if not stage_ids:
73 vals['state'] = self.browse(cr, uid, stage_id, context=context).state
74 vals['project_ids'] = [(6, 0, [project_id])]
75 new_stage_id = self.copy(cr, uid, stage_id, default=vals, context=context)
76 else:
77 new_stage_id = stage_ids[0]
78
79 if new_stage_id:
80 project_write = project.write({'type_ids': [(3, stage_id),(4, new_stage_id),]}, context=context)
81 task_write = project_task.write(cr, uid, task_ids, {'stage_id': new_stage_id} , context=context)
82 if project_write and task_write:
83 return {'boolean':True, 'id': new_stage_id}
84 return {'boolean': False, 'id': Null}
85
86 def create(self, cr, uid, value, context=None):
87 if context is None:context = {}
88 stage_id = self.search(cr, uid, [('name','=', value.get('name'))], context=context, limit=1)
89 project_id = context.get('default_project_id', False)
90 if project_id and stage_id:
91 create_return = self._stage_modify(cr, uid, stage_id[0], project_id, value, context=context)
92 return create_return.get('id')
93 return super(project_task_type, self).create(cr, uid, value, context=context)
94
95 def unlink(self, cr, uid, ids, context=None):
96 if context is None: context = {}
97 project_id = context.get('default_project_id')
98 if project_id:
99 project_task = self.pool.get('project.task')
100 for stage_id in ids:
101 task_ids = project_task.search(cr, uid, [('stage_id','=', stage_id),('project_id','=', project_id)])
102 task_write = project_task.write(cr, uid, task_ids, {'stage_id': False} , context=context)
103 project_write = self.pool.get('project.project').write({'type_ids': [cr, uid, project_id, (3, stage_id)]}, context=context)
104 if not project_write or not task_write:
105 return False
106 return True
107 return super(project_task_type,self).unlink(cr, uid, ids, context)
55108
56109
57class project(osv.osv):110class project(osv.osv):
58111
=== modified file 'project/security/ir.model.access.csv'
--- project/security/ir.model.access.csv 2013-07-10 10:15:08 +0000
+++ project/security/ir.model.access.csv 2013-08-13 11:44:00 +0000
@@ -3,7 +3,8 @@
3access_project_project_manager,project.project,model_project_project,project.group_project_manager,1,1,1,13access_project_project_manager,project.project,model_project_project,project.group_project_manager,1,1,1,1
4access_account_analytic_account_user,account.analytic.account,analytic.model_account_analytic_account,project.group_project_user,1,0,0,04access_account_analytic_account_user,account.analytic.account,analytic.model_account_analytic_account,project.group_project_user,1,0,0,0
5access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,project.group_project_manager,1,1,1,15access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,project.group_project_manager,1,1,1,1
6access_project_task_type_user,project.task.type user,model_project_task_type,project.group_project_user,1,1,1,16access_project_task_type_manager,project.task.type manager,model_project_task_type,project.group_project_manager,1,1,1,1
7access_project_task_type_user,project.task.type user,model_project_task_type,project.group_project_user,1,0,0,0
7access_project_task,project.task,model_project_task,project.group_project_user,1,1,1,18access_project_task,project.task,model_project_task,project.group_project_user,1,1,1,1
8access_project_task_work,project.task.work,model_project_task_work,project.group_project_user,1,1,1,19access_project_task_work,project.task.work,model_project_task_work,project.group_project_user,1,1,1,1
9access_report_project_task_user,report.project.task.user,model_report_project_task_user,project.group_project_manager,1,1,1,110access_report_project_task_user,report.project.task.user,model_report_project_task_user,project.group_project_manager,1,1,1,1

Subscribers

People subscribed via source and target branches

to all changes: