[IMP] hr_recruitment, project: better access rules for categories

bzr revid: abo@openerp.com-20120816144403-4nd2bbiq5dfnwc2i
This commit is contained in:
Antonin Bourguignon 2012-08-16 16:44:03 +02:00
parent f4f7de1369
commit 89a27bf5b6
4 changed files with 23 additions and 7 deletions

View File

@ -198,6 +198,7 @@ class hr_applicant(base_stage, osv.Model):
When the case is over, the state is set to \'Done\'.\ When the case is over, the state is set to \'Done\'.\
If the case needs to be reviewed then the state is \ If the case needs to be reviewed then the state is \
set to \'Pending\'.'), set to \'Pending\'.'),
'categ_ids': fields.many2many('hr.applicant_category', string='Categories'),
'company_id': fields.many2one('res.company', 'Company'), 'company_id': fields.many2one('res.company', 'Company'),
'user_id': fields.many2one('res.users', 'Responsible'), 'user_id': fields.many2one('res.users', 'Responsible'),
# Applicant Columns # Applicant Columns
@ -350,7 +351,7 @@ class hr_applicant(base_stage, osv.Model):
if isinstance(ids, (str, int, long)): if isinstance(ids, (str, int, long)):
ids = [ids] ids = [ids]
if update_vals is None: vals = {} if update_vals is None: vals = {}
update_vals.update({ update_vals.update({
'description': msg.get('body'), 'description': msg.get('body'),
'email_from': msg.get('from'), 'email_from': msg.get('from'),
@ -510,7 +511,7 @@ class hr_job(osv.osv):
_inherits = {'mail.alias': 'alias_id'} _inherits = {'mail.alias': 'alias_id'}
_columns = { _columns = {
'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"), 'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
help="Email alias for this job position. New emails will automatically " help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."), "create new applicants for this job position."),
} }
@ -521,13 +522,13 @@ class hr_job(osv.osv):
def _auto_init(self, cr, context=None): def _auto_init(self, cr, context=None):
"""Installation hook to create aliases for all jobs and avoid constraint errors.""" """Installation hook to create aliases for all jobs and avoid constraint errors."""
# disable the unique alias_id not null constraint, to avoid spurious warning during # disable the unique alias_id not null constraint, to avoid spurious warning during
# super.auto_init. We'll reinstall it afterwards. # super.auto_init. We'll reinstall it afterwards.
self._columns['alias_id'].required = False self._columns['alias_id'].required = False
super(hr_job,self)._auto_init(cr, context=context) super(hr_job,self)._auto_init(cr, context=context)
registry = RegistryManager.get(cr.dbname) registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias') mail_alias = registry.get('mail.alias')
hr_jobs = registry.get('hr.job') hr_jobs = registry.get('hr.job')
@ -555,7 +556,7 @@ class hr_job(osv.osv):
mail_alias = self.pool.get('mail.alias') mail_alias = self.pool.get('mail.alias')
if not vals.get('alias_id'): if not vals.get('alias_id'):
vals.pop('alias_name', None) # prevent errors during copy() vals.pop('alias_name', None) # prevent errors during copy()
alias_id = mail_alias.create_unique_alias(cr, uid, alias_id = mail_alias.create_unique_alias(cr, uid,
# Using '+' allows using subaddressing for those who don't # Using '+' allows using subaddressing for those who don't
# have a catchall domain setup. # have a catchall domain setup.
{'alias_name': 'jobs+'+vals['name']}, {'alias_name': 'jobs+'+vals['name']},
@ -573,7 +574,7 @@ class hr_job(osv.osv):
res = super(hr_job, self).unlink(cr, uid, ids, context=context) res = super(hr_job, self).unlink(cr, uid, ids, context=context)
mail_alias.unlink(cr, uid, alias_ids, context=context) mail_alias.unlink(cr, uid, alias_ids, context=context)
return res return res
def action_print_survey(self, cr, uid, ids, context=None): def action_print_survey(self, cr, uid, ids, context=None):
if context is None: if context is None:
context = {} context = {}
@ -591,4 +592,12 @@ class hr_job(osv.osv):
'nodestroy':True, 'nodestroy':True,
} }
class applicant_category(osv.osv):
""" Category of applicant """
_name = "hr.applicant_category"
_description = "Category of applicant"
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -176,6 +176,9 @@
</div> </div>
</group> </group>
</group> </group>
<group>
<field name="categ_ids" widget="many2many_tags"/>
</group>
<separator string="Application Summary"/> <separator string="Application Summary"/>
<field name="description" placeholder="Feedback of interviews..."/> <field name="description" placeholder="Feedback of interviews..."/>
</sheet> </sheet>

View File

@ -8,3 +8,5 @@ access_survey_hr_user,survey.hr.user,survey.model_survey,base.group_hr_user,1,1,
access_crm_meeting_hruser,crm.meeting.hruser,base_calendar.model_crm_meeting,base.group_hr_user,1,1,1,1 access_crm_meeting_hruser,crm.meeting.hruser,base_calendar.model_crm_meeting,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_hr_officer,hr.recruitment.source,model_hr_recruitment_source,base.group_hr_user,1,1,1,1 access_hr_recruitment_source_hr_officer,hr.recruitment.source,model_hr_recruitment_source,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0 access_hr_recruitment_source_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0
access_hr_applicant_category,hr.applicant_category,model_hr_applicant_category,,1,0,0,0
access_hr_applicant_category_manager,hr.applicant_category,model_hr_applicant_category,base.group_hr_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_crm_meeting_hruser crm.meeting.hruser base_calendar.model_crm_meeting base.group_hr_user 1 1 1 1
9 access_hr_recruitment_source_hr_officer hr.recruitment.source model_hr_recruitment_source base.group_hr_user 1 1 1 1
10 access_hr_recruitment_source_all hr.recruitment.source model_hr_recruitment_source 1 0 0 0
11 access_hr_applicant_category hr.applicant_category model_hr_applicant_category 1 0 0 0
12 access_hr_applicant_category_manager hr.applicant_category model_hr_applicant_category base.group_hr_manager 1 1 1 1

View File

@ -18,3 +18,5 @@ access_account_analytic_line_project,account.analytic.line project,analytic.mode
access_project_task_history,project.task.history project,project.model_project_task_history,project.group_project_user,1,1,1,0 access_project_task_history,project.task.history project,project.model_project_task_history,project.group_project_user,1,1,1,0
access_project_task_history_cumulative,project.task.history project,project.model_project_task_history_cumulative,project.group_project_manager,1,0,0,0 access_project_task_history_cumulative,project.task.history project,project.model_project_task_history_cumulative,project.group_project_manager,1,0,0,0
access_resource_calendar,project.resource_calendar manager,resource.model_resource_calendar,project.group_project_manager,1,0,0,0 access_resource_calendar,project.resource_calendar manager,resource.model_resource_calendar,project.group_project_manager,1,0,0,0
access_project_category,project.project_category,model_project_category,,1,0,0,0
access_project_category_manager,project.project_category,model_project_category,project.group_project_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
18 access_project_task_history project.task.history project project.model_project_task_history project.group_project_user 1 1 1 0
19 access_project_task_history_cumulative project.task.history project project.model_project_task_history_cumulative project.group_project_manager 1 0 0 0
20 access_resource_calendar project.resource_calendar manager resource.model_resource_calendar project.group_project_manager 1 0 0 0
21 access_project_category project.project_category model_project_category 1 0 0 0
22 access_project_category_manager project.project_category model_project_category project.group_project_manager 1 1 1 1