From c8c3287bcc11f636dbbf512c7051801cc2df49ff Mon Sep 17 00:00:00 2001 From: "Yogesh (OpenERP)" Date: Tue, 22 Feb 2011 17:14:33 +0530 Subject: [PATCH] [IMP] hr_evluation :- integrate email.compose.message wizard. if active_model=ir.ui.menu then visible reffere document field and select the record and then send mail. bzr revid: ysa@tinyerp.com-20110222114433-riy38xpuuptpzblf --- addons/emails/wizard/email_compose_message.py | 21 +++++++++++++++ .../wizard/email_compose_message_view.xml | 4 +++ addons/hr_evaluation/__openerp__.py | 2 +- addons/hr_evaluation/hr_evaluation_view.xml | 27 ++++++++++++++----- addons/hr_evaluation/wizard/__init__.py | 3 ++- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/addons/emails/wizard/email_compose_message.py b/addons/emails/wizard/email_compose_message.py index 738b1561119..184677d29ba 100644 --- a/addons/emails/wizard/email_compose_message.py +++ b/addons/emails/wizard/email_compose_message.py @@ -31,6 +31,7 @@ class email_compose_message(osv.osv_memory): def default_get(self, cr, uid, fields, context=None): if context is None: context = {} + result = super(email_compose_message, self).default_get(cr, uid, fields, context=context) message_pool = self.pool.get('email.message') message_id = context.get('message_id', False) @@ -98,13 +99,33 @@ class email_compose_message(osv.osv_memory): if 'debug' in fields: result['debug'] = message_data and message_data.debug + if 'model' in fields and context.get('email_model',False): + result['model'] = context.get('email_model') + return result + def _get_records(self, cr, uid, context=None): + """ + Return Records of particular Model + """ + if context is None: + context = {} + record_ids = [] + if context.get('email_model',False): + model_pool = self.pool.get(context.get('email_model')) + record_ids = model_pool.search(cr, uid, []) + return model_pool.name_get(cr, uid, record_ids, context) + return record_ids + _columns = { 'attachment_ids': fields.many2many('ir.attachment','email_message_send_attachment_rel', 'wizard_id', 'attachment_id', 'Attachments'), 'debug':fields.boolean('Debug', readonly=True), + 'resource_id':fields.selection(_get_records, 'Referred Document'), } + def on_change_referred_doc(self, cr, uid, ids, model, resource_id, context=None): + return {'value':{}} + def save_to_drafts(self, cr, uid, ids, context=None): if context is None: context = {} diff --git a/addons/emails/wizard/email_compose_message_view.xml b/addons/emails/wizard/email_compose_message_view.xml index f23a718ad76..091888f3508 100644 --- a/addons/emails/wizard/email_compose_message_view.xml +++ b/addons/emails/wizard/email_compose_message_view.xml @@ -9,6 +9,10 @@
+ + + diff --git a/addons/hr_evaluation/__openerp__.py b/addons/hr_evaluation/__openerp__.py index ec78dcc8643..b7cfaf96489 100644 --- a/addons/hr_evaluation/__openerp__.py +++ b/addons/hr_evaluation/__openerp__.py @@ -41,7 +41,7 @@ "update_xml": [ "security/ir.model.access.csv", "security/hr_evaluation_security.xml", - "wizard/hr_evaluation_mail_view.xml", +# "wizard/hr_evaluation_mail_view.xml", "hr_evaluation_view.xml", "report/hr_evaluation_report_view.xml", "board_hr_evaluation_view.xml" diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index 99f34f7cc7b..b144946a685 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -250,12 +250,12 @@ - + - + @@ -399,17 +399,30 @@ + + + + Send E-mail + email.compose.message + email.compose.message + ir.actions.act_window + form + form + {'email_model':'hr.evaluation.interview'} + new + + + action="action_email_compose_message_menu_wizard" sequence="45" groups="base.group_hr_manager"/> - diff --git a/addons/hr_evaluation/wizard/__init__.py b/addons/hr_evaluation/wizard/__init__.py index 1a855087bbc..7036af4f659 100644 --- a/addons/hr_evaluation/wizard/__init__.py +++ b/addons/hr_evaluation/wizard/__init__.py @@ -19,6 +19,7 @@ # ############################################################################## -import hr_evaluation_mail +#import hr_evaluation_mail +import email_compose_message # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: