[CLEAN] hr: moved color field + an action in hr_recruitment, because they are used in this module + removed unnecessary code

bzr revid: tde@openerp.com-20140211120433-f34jsy7xjga1ultt
This commit is contained in:
Thibault Delavallée
2014-02-11 13:04:33 +01:00
parent 38604c3761
commit 610ebaef85
3 changed files with 8 additions and 11 deletions
-9
View File
@@ -120,7 +120,6 @@ class hr_job(osv.Model):
string='Status', readonly=True, required=True,
track_visibility='always',
help="By default 'Closed', set it to 'In Recruitment' if recruitment process is going on for this job position."),
'color': fields.integer('Color Index'),
'write_date': fields.datetime('Update Date', readonly=True),
}
@@ -134,14 +133,6 @@ class hr_job(osv.Model):
('hired_employee_check', "CHECK ( no_of_hired_employee <= no_of_recruitment )", "Number of hired employee must be less than expected number of employee in recruitment."),
]
def on_change_expected_employee(self, cr, uid, ids, no_of_recruitment, no_of_employee, context=None):
if context is None:
context = {}
return {'value': {'expected_employees': no_of_recruitment + no_of_employee}}
def action_set_no_of_recruitment(self, cr, uid, id, value, context=None):
return self.write(cr, uid, [id], {'no_of_recruitment': value}, context=context)
def set_recruit(self, cr, uid, ids, context=None):
for job in self.browse(cr, uid, ids, context=context):
no_of_recruitment = job.no_of_recruitment == 0 and 1 or job.no_of_recruitment
+2 -1
View File
@@ -347,7 +347,7 @@
<field name="department_id" class="oe_inline"/>
<label for="no_of_employee"/>no_of_recruitment
<div>
<field name="no_of_employee" on_change="on_change_expected_employee(no_of_recruitment,no_of_employee)" class="oe_inline"/>
<field name="no_of_employee" class="oe_inline"/>
<p><field name="no_of_recruitment" groups="base.group_user" colspan="0" class="oe_inline" style="padding-top: 1px"/> new employee(s) expected</p>
</div>
</group>
@@ -378,6 +378,7 @@
<field name="no_of_employee"/>
<field name="no_of_recruitment"/>
<field name="expected_employees"/>
<field name="no_of_hired_employee"/>
<field name="state"/>
</tree>
</field>
+6 -1
View File
@@ -527,11 +527,12 @@ class hr_job(osv.osv):
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
'address_id': fields.many2one('res.partner', 'Job Location', help="Address where employees are working"),
'application_ids': fields.one2many('hr.applicant', 'job_id', 'Applications'),
'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True),
'document_ids': fields.function(_get_attached_docs, type='one2many', relation='ir.attachment', string='Applications'),
'user_id': fields.many2one('res.users', 'Recruitment Responsible', track_visibility='onchange'),
'address_id': fields.many2one('res.partner', 'Job Location', help="Address where employees are working"),
'color': fields.integer('Color Index'),
}
def _address_get(self, cr, uid, context=None):
@@ -588,6 +589,10 @@ class hr_job(osv.osv):
action['domain'] = str(['|', '&', ('res_model', '=', 'hr.job'), ('res_id', 'in', ids), '&', ('res_model', '=', 'hr.applicant'), ('res_id', 'in', applicant_ids)])
return action
def action_set_no_of_recruitment(self, cr, uid, id, value, context=None):
return self.write(cr, uid, [id], {'no_of_recruitment': value}, context=context)
class applicant_category(osv.osv):
""" Category of applicant """
_name = "hr.applicant_category"