diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 1f3e960fb6e..590c1a9ad83 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -300,6 +300,51 @@ class hr_evaluation_interview(osv.osv):
self.write(cr, uid, ids, { 'state' : 'cancel'}, context=context)
return True
+ def action_print_survey(self, cr, uid, ids, context=None):
+ """
+ If response is available then print this response otherwise print survey form(print template of the survey).
+
+ @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 Survey IDs
+ @param context: A standard dictionary for contextual values
+ @return : Dictionary value for print survey form.
+ """
+ if not context:
+ context = {}
+ record = self.browse(cr, uid, ids, context)
+ record = record and record[0]
+ datas = {}
+ page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
+ report = {}
+ if record:
+ datas['ids'] = [record.survey_id.id]
+ response_id = record.response.id
+ if response_id:
+ context.update({'survey_id': datas['ids'], 'response_id' : [response_id], 'response_no':0})
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print.answer'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.browse.response',
+ 'datas': datas,
+ 'nodestroy': True,
+ 'context' : context
+ }
+ else:
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'nodestroy':True,
+ 'context' : context
+ }
+ return report
+
+
hr_evaluation_interview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
index fa50f944fa1..d59ac82a661 100644
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ b/addons/hr_evaluation/hr_evaluation_view.xml
@@ -261,8 +261,8 @@
-
+
@@ -297,8 +297,8 @@
-
+
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 27767c493cb..fca0455e18a 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -20,6 +20,7 @@
##############################################################################
from osv import fields,osv,orm
+from tools.translate import _
AVAILABLE_STATES = [
('draft','New'),
@@ -54,13 +55,145 @@ class hr_applicant(osv.osv):
'partner_name': fields.char("Applicant's Name", size=64),
'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32),
- 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
- 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
+ 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('object_id.model', '=', 'hr.applicant')]"),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('object_id.model', '=', 'hr.applicant')]"),
'department_id':fields.many2one('hr.department','Department'),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
'response' : fields.integer("Response"),
}
+
+ def stage_previous(self, cr, uid, ids, context=None):
+ """This function computes previous stage for case from its current stage
+ using available stage for that case type
+ @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 case IDs
+ @param context: A standard dictionary for contextual values"""
+ if not context:
+ context = {}
+ for case in self.browse(cr, uid, ids, context):
+ section = (case.section_id.id or False)
+ st = case.stage_id.id or False
+ stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [])
+ if st and stage_ids.index(st):
+ self.write(cr, uid, [case.id], {'stage_id': stage_ids[stage_ids.index(st)-1]})
+ return True
+
+ def stage_next(self, cr, uid, ids, context=None):
+ """This function computes next stage for case from its current stage
+ using available stage for that case type
+ @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 case IDs
+ @param context: A standard dictionary for contextual values"""
+ if not context:
+ context = {}
+ for case in self.browse(cr, uid, ids, context):
+ section = (case.section_id.id or False)
+ st = case.stage_id.id or False
+ stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [])
+ if st and len(stage_ids) != stage_ids.index(st)+1:
+ self.write(cr, uid, [case.id], {'stage_id': stage_ids[stage_ids.index(st)+1]})
+ return True
+
+ def action_makeMeeting(self, cr, uid, ids, context=None):
+ """
+ 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
+ """
+ value = {}
+ for opp in self.browse(cr, uid, ids):
+ data_obj = self.pool.get('ir.model.data')
+
+ # Get meeting views
+ result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
+ res = data_obj.read(cr, uid, result, ['res_id'])
+ id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
+ id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
+ id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
+ if id1:
+ id1 = data_obj.browse(cr, uid, id1, context=context).res_id
+ 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
+
+ context = {
+ 'default_opportunity_id': opp.id,
+ 'default_partner_id': opp.partner_id and opp.partner_id.id or False,
+ 'default_section_id': opp.section_id and opp.section_id.id or False,
+ 'default_email_from': opp.email_from,
+ 'default_state': 'open',
+ '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': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')],
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': res['res_id'],
+ 'nodestroy': True
+ }
+ return value
+
+ def action_print_survey(self, cr, uid, ids, context=None):
+ """
+ If response is available then print this response otherwise print survey form(print template of the survey).
+
+ @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 Survey IDs
+ @param context: A standard dictionary for contextual values
+ @return : Dictionary value for print survey form.
+ """
+ if not context:
+ context = {}
+ datas = {}
+ record = self.browse(cr, uid, ids, context)
+ record = record and record[0]
+ page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
+ report = {}
+ if record:
+ datas['ids'] = [record.survey.id]
+ response_id = record.response
+ if response_id:
+ context.update({'survey_id': datas['ids'], 'response_id' : [response_id], 'response_no':0,})
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print.answer'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.browse.response',
+ 'datas': datas,
+ 'nodestroy': True,
+ 'context' : context
+ }
+ else:
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'nodestroy':True,
+ 'context' : context
+ }
+ return report
+
hr_applicant()
class hr_job(osv.osv):
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 3416ba08f24..c31b58f74be 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -43,8 +43,8 @@
-
-
+
+
@@ -71,8 +71,9 @@
-
+
+
@@ -84,10 +85,11 @@
-
-
-
+
+
+
diff --git a/addons/hr_recruitment/hr_recruitment_wizard.xml b/addons/hr_recruitment/hr_recruitment_wizard.xml
index d82153eabbb..b2ef149d604 100644
--- a/addons/hr_recruitment/hr_recruitment_wizard.xml
+++ b/addons/hr_recruitment/hr_recruitment_wizard.xml
@@ -9,14 +9,6 @@
multi="True"
string="Schedule Phone Call" />
-
-
diff --git a/addons/survey/survey.py b/addons/survey/survey.py
index a1db5bdcc86..5acc1c73d06 100644
--- a/addons/survey/survey.py
+++ b/addons/survey/survey.py
@@ -95,6 +95,46 @@ class survey(osv.osv):
def copy(self, cr, uid, id, default=None,context={}):
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
+ def action_print_survey(self, cr, uid, ids, context=None):
+ """
+ If response is available then print this response otherwise print survey form(print template of the survey).
+ @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 Survey IDs
+ @param context: A standard dictionary for contextual values
+ @return : Dictionary value for print survey form.
+ """
+ if not context:
+ context = {}
+ datas = {}
+ response_id = self.pool.get('survey.response').search(cr, uid, [('survey_id','=', ids)], context=context)
+ page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
+ report = {}
+ datas['ids'] = ids
+ if response_id:
+ context.update({'survey_id': datas['ids']})
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print.answer'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.browse.response',
+ 'datas': datas,
+ 'nodestroy': True,
+ 'context' : context
+ }
+ else:
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'nodestroy':True,
+ 'context' : context
+ }
+ return report
+
survey()
class survey_history(osv.osv):
diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml
index 4d6fc536dd2..5b1eaef72f4 100644
--- a/addons/survey/survey_view.xml
+++ b/addons/survey/survey_view.xml
@@ -243,8 +243,8 @@
string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
-
+