Turkesh Patel (openERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-mail-alias-jam-mail-hr-tpa into
lp:~openerp-dev/openobject-addons/trunk-mail-alias-jam.
Requested reviews:
Jigar Amin (OpenERP) (jam-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-mail-alias-jam-mail-hr-tpa/+merge/111824
[IMP] hr_recruitment: added functionality of mail.alias
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-mail-alias-jam-mail-hr-tpa/+merge/111824
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-mail-alias-jam.
=== modified file 'hr_recruitment/hr_recruitment.py'
--- hr_recruitment/hr_recruitment.py 2012-06-14 14:41:59 +0000
+++ hr_recruitment/hr_recruitment.py 2012-06-25 11:45:24 +0000
@@ -549,10 +549,25 @@
class hr_job(osv.osv):
_inherit = "hr.job"
_name = "hr.job"
+ _inherits = {'mail.alias': 'alias_id'}
_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"),
+ 'alias_id': fields.many2one('mail.alias', 'Mail Alias', ondelete="cascade", required=True),
}
+ def create(self, cr, uid, vals, context=None):
+ model_pool = self.pool.get('ir.model.data')
+ alias_pool = self.pool.get('mail.alias')
+ res_id = model_pool.get_object( cr, uid, "hr_recruitment", "model_hr_applicant")
+ vals.update({'alias_name': "job",
+ 'alias_model_id': res_id.id})
+ name = alias_pool.create_unique_alias(cr, uid, vals, context=context)
+ res = super( hr_job, self).create(cr, uid, vals, context)
+ record = self.read(cr, uid, res, context)
+ alias_pool.write(cr, uid, [record['alias_id']], {"alias_defaults": {'job_id': record['id']}}, context)
+ return res
+
+
def action_print_survey(self, cr, uid, ids, context=None):
if context is None:
context = {}
=== modified file 'hr_recruitment/hr_recruitment_data.xml'
--- hr_recruitment/hr_recruitment_data.xml 2012-06-13 12:45:31 +0000
+++ hr_recruitment/hr_recruitment_data.xml 2012-06-25 11:45:24 +0000
@@ -449,5 +449,13 @@
<field name="question_id" ref="survey_question_job_1"/>
<field eval="13" name="sequence"/>
</record>
+
+ <record id="mail_alias_jobs" model="mail.alias">
+ <field name="alias_name">[email protected]</field>
+ <field name="alias_model_id" ref="model_hr_applicant"/>
+ <field name="alias_user_id" ref="base.user_root"/>
+ <field name="alias_defaults">{}</field>
+ </record>
+
</data>
</openerp>
=== modified file 'hr_recruitment/hr_recruitment_demo.yml'
--- hr_recruitment/hr_recruitment_demo.yml 2012-05-04 12:13:26 +0000
+++ hr_recruitment/hr_recruitment_demo.yml 2012-06-25 11:45:24 +0000
@@ -1,4 +1,13 @@
-
+ !record {model: mail.alias, id: alias_id_1, view: False}:
+ alias_name: '[email protected]'
+ alias_model_id: model_hr_applicant
+ alias_user_id: base.user_root
+ alias_defaults: '{}'
+-
+ !record {model: hr.job, id: hr.job_developer, view: False}:
+ alias_id: alias_id_1
+-
!record {model: hr.applicant, id: hr_case_salesman0}:
date: !eval time.strftime('%Y-%m-01 10:35:50')
type_id: degree_graduate
=== modified file 'hr_recruitment/hr_recruitment_view.xml'
--- hr_recruitment/hr_recruitment_view.xml 2012-06-20 15:16:25 +0000
+++ hr_recruitment/hr_recruitment_view.xml 2012-06-25 11:45:24 +0000
@@ -352,6 +352,9 @@
attrs="{'invisible':[('survey_id','=',False)]}"/>
</div>
</field>
+ <field name="company_id" version="7.0" position="after">
+ <field name="alias_id" required="0"/>
+ </field>
</field>
</record>
=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py 2012-06-22 10:50:57 +0000
+++ mail/mail_thread.py 2012-06-25 11:45:24 +0000
@@ -473,7 +473,7 @@
"""
alias_pool = self.pool.get('mail.alias')
- user_pool = self.pool.get('res.user')
+ user_pool = self.pool.get('res.users')
mail_compose_pool = self.pool.get('mail.compose.message')
mail_message_pool = self.pool.get('mail.message')
if isinstance(message, xmlrpclib.Binary):
@@ -486,10 +486,11 @@
msg_txt = email.message_from_string(message)
msg = mail_message_pool.parse_message(msg_txt)
alias_name = msg.get('to')
- alias_ids = alias_pool.search(cr, uid, [('alias_name','=',alias_name)],context)
- alias_id = alias_pool.browse(cr, uid, alias_ids[0], context)
+ alias_ids = alias_pool.search(cr, uid, [('alias_name','=',alias_name)])
+
#if alias found then call message_process method.
- if alias_id:
+ if alias_ids:
+ alias_id = alias_pool.browse(cr, uid, alias_ids[0], context)
user_id = self._get_user( cr, uid, alias_id, context)
self.message_process(cr, user_id, alias_id.alias_model_id.model, message,
custom_values = alias_id.alias_defaults or {},
@@ -500,7 +501,7 @@
#_logger.warning("This mailbox does not exist so mail gate will reject this mail.")
from_email = user_pool.browse(cr, uid, uid, context).user_email
sub = "Mail Rejection" + msg.get('subject')
- message = "Respective mailbox does not exist so your mail have been rejected" + msg
+ message = "Respective mailbox does not exist so your mail have been rejected" + msg.get('body')
mail_compose_pool.send_mail(cr, uid, {'email_from': from_email,'email_to': msg.get('from'),'subject': sub, 'body_text': message}, context)
return True
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp