[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
This commit is contained in:
Yogesh (OpenERP)
2011-02-22 17:14:33 +05:30
parent fd88efc23b
commit c8c3287bcc
5 changed files with 48 additions and 9 deletions
@@ -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 = {}
@@ -9,6 +9,10 @@
<field name="arch" type="xml">
<form string="Reply Email">
<group col="6" colspan="4">
<field name="model" invisible="1"/>
<field name="resource_id" invisible="context.get('active_model','') != 'ir.ui.menu'"
colspan="4" on_change="on_change_referred_doc(model, resource_id)"/>
<field name="res_id" invisible="1"/>
<field name="smtp_server_id" widget="selection" colspan="4"/>
<field name="email_from" colspan="4" required="1"/>
<field name="email_to" colspan="4" required="1"/>
+1 -1
View File
@@ -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"
+20 -7
View File
@@ -250,12 +250,12 @@
<field name="arch" type="xml">
<search string="Search Evaluation">
<group col='10' colspan='4'>
<filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/>
<filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/>
<filter icon="terp-camera_test" string="In progress" domain="[('state','=','progress')]" help="Evaluations that are in progress state"/>
<separator orientation="vertical"/>
<filter icon="terp-go-week" string="7 Days" help="Evaluations to close within the next 7 days"
domain="[('date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
<separator orientation="vertical"/>
<separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
help="Evaluations that overpassed the deadline" domain="[('date','&lt;=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]" />
<separator orientation="vertical"/>
@@ -399,17 +399,30 @@
<field name="act_window_id" ref="action_hr_evaluation_interview_tree"/>
</record>
<!-- Email Compose message Action-->
<record id="action_email_compose_message_menu_wizard" model="ir.actions.act_window">
<field name="name">Send E-mail</field>
<field name="res_model">email.compose.message</field>
<field name="src_model">email.compose.message</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="context">{'email_model':'hr.evaluation.interview'}</field>
<field name="target">new</field>
</record>
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
<menuitem name="Evaluation Reminders" parent="menu_eval_hr" id="menu_eval_send_mail"
action="action_hr_evaluation_send_mail" sequence="45" groups="base.group_hr_manager"/>
action="action_email_compose_message_menu_wizard" sequence="45" groups="base.group_hr_manager"/>
<!-- Evaluation Interviews Button on Employee Form -->
<act_window
<act_window
context="{'search_default_user_to_review_id': [active_id]}"
id="act_hr_employee_2_hr__evaluation_interview"
name="Evaluation Interviews"
res_model="hr.evaluation.interview"
id="act_hr_employee_2_hr__evaluation_interview"
name="Evaluation Interviews"
res_model="hr.evaluation.interview"
src_model="hr.employee"/>
</data>
+2 -1
View File
@@ -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: