+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py
index 6f9f61afabc..4509508b2be 100644
--- a/addons/hr_holidays/__openerp__.py
+++ b/addons/hr_holidays/__openerp__.py
@@ -50,7 +50,7 @@ Note that:
for example, you maybe will do it for the user 'admin'.
""",
'images': ['images/hr_allocation_requests.jpeg', 'images/hr_leave_requests.jpeg', 'images/leaves_analysis.jpeg'],
- 'depends': ['hr', 'crm', 'process', 'resource'],
+ 'depends': ['hr', 'base_calendar', 'process', 'resource'],
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index a1ab0ae04f3..2a2648f1beb 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -74,7 +74,8 @@ class hr_holidays_status(osv.osv):
_columns = {
'name': fields.char('Leave Type', size=64, required=True, translate=True),
- 'categ_id': fields.many2one('crm.case.categ', 'Meeting', domain="[('object_id.model', '=', 'crm.meeting')]", help='If you set a meeting type, OpenERP will create a meeting in the calendar once a leave is validated.'),
+ 'categ_id': fields.many2one('crm.meeting.type', 'Meeting Type',
+ help='Once a leave is validated, OpenERP will create a corresponding meeting of this type in the calendar.'),
'color_name': fields.selection([('red', 'Red'),('blue','Blue'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color in Report', required=True, help='This color will be used in the leaves summary located in Reporting\Leaves by Departement'),
'limit': fields.boolean('Allow to Override Limit', help='If you select this checkbox, the system allows the employees to take more leaves than the available ones for this type.'),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the leave type without removing it."),
@@ -128,7 +129,7 @@ class hr_holidays(osv.osv):
'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'number_of_days': fields.function(_compute_number_of_days, string='Number of Days', store=True),
- 'case_id': fields.many2one('crm.meeting', 'Meeting'),
+ 'meeting_id': fields.many2one('crm.meeting', 'Meeting'),
'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone", select=True),
'parent_id': fields.many2one('hr.holidays', 'Parent'),
'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
@@ -217,19 +218,12 @@ class hr_holidays(osv.osv):
}
return result
- def onchange_sec_id(self, cr, uid, ids, status, context=None):
- warning = {}
+ def onchange_status_id(self, cr, uid, ids, status_id, context=None):
double_validation = False
- obj_holiday_status = self.pool.get('hr.holidays.status')
- if status:
- holiday_status = obj_holiday_status.browse(cr, uid, status, context=context)
+ if status_id:
+ holiday_status = self.pool.get('hr.holidays.status').browse(cr, uid, status_id, context=context)
double_validation = holiday_status.double_validation
- if holiday_status.categ_id and holiday_status.categ_id.section_id and not holiday_status.categ_id.section_id.allow_unlink:
- warning = {
- 'title': "Warning for ",
- 'message': "You won\'t be able to cancel this leave request because the CRM Sales Team of the leave type disallows."
- }
- return {'warning': warning, 'value': {'double_validation': double_validation}}
+ return {'value': {'double_validation': double_validation}}
def set_to_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {
@@ -271,7 +265,7 @@ class hr_holidays(osv.osv):
holiday_ids.append(record.id)
if record.holiday_type == 'employee' and record.type == 'remove':
meeting_obj = self.pool.get('crm.meeting')
- vals = {
+ meeting_vals = {
'name': record.name,
'categ_id': record.holiday_status_id.categ_id.id,
'duration': record.number_of_days_temp * 8,
@@ -280,11 +274,11 @@ class hr_holidays(osv.osv):
'date': record.date_from,
'end_date': record.date_to,
'date_deadline': record.date_to,
- 'leave_id': record.id,
+ 'state': 'done', # to block that meeting date in the calendar
}
- case_id = meeting_obj.create(cr, uid, vals)
+ meeting_id = meeting_obj.create(cr, uid, meeting_vals)
self._create_resource_leave(cr, uid, [record], context=context)
- self.write(cr, uid, ids, {'case_id': case_id})
+ self.write(cr, uid, ids, {'meeting_id': meeting_id})
elif record.holiday_type == 'category':
emp_ids = obj_emp.search(cr, uid, [('category_ids', 'child_of', [record.category_id.id])])
leave_ids = []
@@ -330,11 +324,11 @@ class hr_holidays(osv.osv):
return True
def holidays_cancel(self, cr, uid, ids, context=None):
- obj_crm_meeting = self.pool.get('crm.meeting')
+ meeting_obj = self.pool.get('crm.meeting')
for record in self.browse(cr, uid, ids):
# Delete the meeting
- if record.case_id:
- obj_crm_meeting.unlink(cr, uid, [record.case_id.id])
+ if record.meeting_id:
+ meeting_obj.unlink(cr, uid, [record.meeting_id.id])
# If a category that created several holidays, cancel all related
wf_service = netsvc.LocalService("workflow")
@@ -519,10 +513,4 @@ class hr_employee(osv.osv):
hr_employee()
-class crm_meeting(osv.osv):
- _inherit = 'crm.meeting'
- _columns = {
- 'leave_id': fields.many2one('hr.holidays','Leave'),
- }
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml
index 1237cdb14f4..c22c4add718 100644
--- a/addons/hr_holidays/hr_holidays_view.xml
+++ b/addons/hr_holidays/hr_holidays_view.xml
@@ -119,7 +119,7 @@
-
+
-
@@ -178,7 +178,7 @@
-
+
diff --git a/addons/hr_recruitment/__openerp__.py b/addons/hr_recruitment/__openerp__.py
index b83a482e1c1..e5df8cf2bf3 100644
--- a/addons/hr_recruitment/__openerp__.py
+++ b/addons/hr_recruitment/__openerp__.py
@@ -42,11 +42,10 @@ system to store and search in your CV base.
'decimal_precision',
'hr',
'survey',
- 'crm',
+ 'base_calendar',
'fetchmail',
],
'update_xml': [
- 'wizard/hr_recruitment_phonecall_view.xml',
'wizard/hr_recruitment_employee_hired.xml',
'wizard/hr_recruitment_create_partner_job_view.xml',
'hr_recruitment_view.xml',
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 26eeca1aedc..a3cd2f3a629 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -24,15 +24,10 @@ import time
from datetime import datetime, timedelta
from osv import fields, osv
-from crm import crm
import tools
import collections
import binascii
-import tools
from tools.translate import _
-from crm import wizard
-
-wizard.mail_compose_message.SUPPORTED_MODELS.append('hr.applicant')
AVAILABLE_STATES = [
('draft', 'New'),
@@ -98,6 +93,7 @@ class hr_applicant(base_stage, osv.Model):
_description = "Applicant"
_order = "id desc"
_inherit = ['ir.needaction_mixin', 'mail.thread']
+ _mail_compose_message = True
def _get_default_department_id(self, cr, uid, context=None):
""" Gives default department by checking if present in the context """
@@ -239,7 +235,7 @@ class hr_applicant(base_stage, osv.Model):
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),
'priority': lambda *a: '',
- 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
+ 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),
'color': 0,
}
@@ -293,49 +289,22 @@ class hr_applicant(base_stage, osv.Model):
return False
def action_makeMeeting(self, cr, uid, ids, context=None):
+ """ This opens Meeting's calendar view to schedule meeting on current applicant
+ @return: Dictionary value for created Meeting view
"""
- This opens Meeting's calendar view to schedule meeting on current Opportunity
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Opportunity to Meeting IDs
- @param context: A standard dictionary for contextual values
-
- @return: Dictionary value for created Meeting view
- """
- data_obj = self.pool.get('ir.model.data')
- if context is None:
- context = {}
- value = {}
- for opp in self.browse(cr, uid, ids, context=context):
- # Get meeting views
- search_view = data_obj.get_object(cr, uid, 'crm', 'view_crm_case_meetings_filter', context)
- calendar_view = data_obj.get_object(cr, uid, 'crm', 'crm_case_calendar_view_meet', context)
- form_view = data_obj.get_object(cr, uid, 'crm', 'crm_case_form_view_meet', context)
- tree_view = data_obj.get_object(cr, uid, 'crm', 'crm_case_tree_view_meet', context)
- category = data_obj.get_object(cr, uid, 'hr_recruitment', 'categ_meet_interview', context)
- context.update({
- 'default_applicant_id': opp.id,
- 'default_partner_id': opp.partner_id and opp.partner_id.id or False,
- 'default_email_from': opp.email_from,
- 'default_state': 'open',
- 'default_categ_id': category.id,
- 'default_name': opp.name,
- })
- value = {
- 'name': ('Meetings'),
- 'domain': "[('user_id','=',%s)]" % (uid),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'calendar,form,tree',
- 'res_model': 'crm.meeting',
- 'view_id': False,
- 'views': [(calendar_view.id, 'calendar'), (form_view.id, 'form'), (tree_view.id, 'tree')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': search_view.id,
- 'nodestroy': True,
- }
- return value
+ applicant = self.browse(cr, uid, ids[0], context)
+ category = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_recruitment', 'categ_meet_interview', context)
+ res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'base_calendar', 'action_crm_meeting', context)
+ res['context'] = {
+ 'default_applicant_id': applicant.id,
+ 'default_partner_id': applicant.partner_id and applicant.partner_id.id or False,
+ 'default_user_id': uid,
+ 'default_email_from': applicant.email_from,
+ 'default_state': 'open',
+ 'default_name': applicant.name,
+ 'default_categ_id': category.id,
+ }
+ return res
def action_print_survey(self, cr, uid, ids, context=None):
"""
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml
index 13436bef45a..fe5d3d9969b 100644
--- a/addons/hr_recruitment/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/hr_recruitment_data.xml
@@ -5,11 +5,9 @@
-->
-
-
+
+ Interview
-
-
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 285ab13f8d2..9118fb05ea1 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -16,18 +16,6 @@
view_mode="tree,form,calendar,graph"
view_type="form"/>
- # ------------------------------------------------------
- # Job Categories
- # ------------------------------------------------------
-
-
- Applicant Categories
- crm.case.categ
- form
-
- [('object_id.model', '=', 'hr.applicant')]
-
-
# ------------------------------------------------------
# Stage
# ------------------------------------------------------
@@ -517,21 +505,15 @@
action="hr_recruitment_source_action"
sequence="10" groups="base.group_no_one"/>
-
+ CRM - Meetings Formcrm.meetingform
-
+
-
- {'invisible': [('categ_id','=',%(hr_recruitment.categ_meet_interview)d)]}
-
-
- {'invisible': [('categ_id','=',%(hr_recruitment.categ_meet_interview)d)]}
-
diff --git a/addons/hr_recruitment/security/ir.model.access.csv b/addons/hr_recruitment/security/ir.model.access.csv
index 6bbc30b7b41..7d082070be5 100644
--- a/addons/hr_recruitment/security/ir.model.access.csv
+++ b/addons/hr_recruitment/security/ir.model.access.csv
@@ -6,7 +6,6 @@ access_hr_recruitment_degree,hr.recruitment.degree,model_hr_recruitment_degree,b
access_mail_message_user,mail.message.user,mail.model_mail_message,base.group_hr_user,1,1,1,1
access_res_partner_hr_user,res.partner.user,base.model_res_partner,base.group_hr_user,1,1,1,1
access_survey_hr_user,survey.hr.user,survey.model_survey,base.group_hr_user,1,1,1,0
-access_crm_phonecall_hruser,crm.phonecall hruser,crm.model_crm_phonecall,base.group_hr_user,1,1,1,1
-access_crm_meeting_hruser,crm.meeting.hruser,crm.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_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0
diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml
index 38b84fccab2..841a49dc866 100644
--- a/addons/hr_recruitment/test/recruitment_process.yml
+++ b/addons/hr_recruitment/test/recruitment_process.yml
@@ -50,13 +50,6 @@
-
!python {model: hr.applicant}: |
self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_developer')})
--
- I start communication with applicant, first schedule phonecall.
--
- !python {model: hr.recruitment.job2phonecall}: |
- context.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
- id = self.create(cr, uid, {}, context=context)
- self.make_phonecall(cr, uid, [id], context=context)
-
I schedule meeting with applicant for interview.
-
diff --git a/addons/hr_recruitment/wizard/__init__.py b/addons/hr_recruitment/wizard/__init__.py
index acabd219857..fde7df63456 100644
--- a/addons/hr_recruitment/wizard/__init__.py
+++ b/addons/hr_recruitment/wizard/__init__.py
@@ -20,7 +20,6 @@
##############################################################################
-import hr_recruitment_phonecall
import hr_recruitment_create_partner_job
import hr_recruitment_employee_hired
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py
deleted file mode 100644
index 12c294c20bc..00000000000
--- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py
+++ /dev/null
@@ -1,126 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# $Id$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-import time
-
-from osv import osv, fields
-from tools.translate import _
-
-class job2phonecall(osv.osv_memory):
- _name = 'hr.recruitment.job2phonecall'
- _description = 'Schedule Phone Call'
- _columns = {
- 'user_id': fields.many2one('res.users', 'Assign To'),
- 'deadline': fields.datetime('Planned Date'),
- 'note': fields.text('Goals'),
- 'category_id': fields.many2one('crm.case.categ', 'Category', required=True),
- }
-
- def _date_user(self, cr, uid, context=None):
- case_obj = self.pool.get('hr.applicant')
- if context is None:
- context = {}
- case = case_obj.browse(cr, uid, context.get('active_id', False), context=context)
- return case.user_id and case.user_id.id or False
-
- def _date_category(self, cr, uid, context=None):
- case_obj = self.pool.get('hr.applicant')
- if context is None:
- context = {}
- case = case_obj.browse(cr, uid, context.get('active_id', False), context=context)
- categ_id = self.pool.get('crm.case.categ').search(cr, uid, [('name','=','Outbound')], context=context)
- return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False
-
- def _get_note(self, cr, uid, context=None):
- mail_message = self.pool.get('mail.message')
- if context is None:
- context = {}
- if context.get('active_id'):
- case = self.pool.get('hr.applicant').browse(cr, uid, context['active_id'], context=context)
- if case.description:
- return case.description
- else:
- msg_ids = mail_message.search(cr, uid, [('model', '=', 'hr.applicant'), ('res_id', '=', case.id), ('email_from', '!=', ''), ('email_to', '!=', '')], limit=1)
- if msg_ids:
- return mail_message.browse(cr, uid, msg_ids[0], context=context).body_text
- return False
-
-
- _defaults = {
- 'user_id': _date_user,
- 'category_id': _date_category,
- 'note': _get_note
- }
-
- def make_phonecall(self, cr, uid, ids, context=None):
- mod_obj = self.pool.get('ir.model.data')
- job_case_obj = self.pool.get('hr.applicant')
- data_obj = self.pool.get('ir.model.data')
- phonecall_case_obj = self.pool.get('crm.phonecall')
- if context is None:
- context = {}
- form = self.browse(cr, uid, ids, context=context)[0]
- result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
- res = mod_obj.read(cr, uid, result, ['res_id'], context=context)
- # Select the view
-
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- new_phonecall_id = []
- for job in job_case_obj.browse(cr, uid, context.get('active_ids', []), context=context):
- #TODO: Take other info from job
- new_phonecall_id = phonecall_case_obj.create(cr, uid, {
- 'name': job.name,
- 'user_id': form.user_id.id,
- 'categ_id': form.category_id.id,
- 'description': form.note,
- 'date': form.deadline,
- 'description': job.description,
- 'partner_id': job.partner_id.id,
- 'partner_phone': job.partner_phone,
- 'partner_mobile': job.partner_mobile,
- 'description': job.description,
- 'date':job.date,
- }, context=context)
- new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id, context=context)
- vals = {}
- job_case_obj.write(cr, uid, [job.id], vals, context=context)
-# job_case_obj.case_cancel(cr, uid, [job.id])
- phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
-
- return {
- 'name': _('Phone Call'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'crm.phonecall',
- 'res_id': new_phonecall_id,
- 'views': [(id3,'form'), (id2,'tree'), (False,'calendar'), (False,'graph')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
-
-job2phonecall()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml b/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml
deleted file mode 100644
index 8537186ac6f..00000000000
--- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- hr.recruitment.job2phonecall.form
- hr.recruitment.job2phonecall
- form
-
-