[IMP] hr_evaluation: send remainder email now uses context values to set some default values when sending an email. This is a basic fix of missing feature due to hr_evaluation/wizard/mail_compose_message override. Updated classic form view of mail.compose.message. Not sure it is usefull to keep two form (one classic and one Chatter)... maybe there is something to do here.

bzr revid: tde@openerp.com-20120904115416-zuvna57r3oj37hpu
This commit is contained in:
Thibault Delavallée 2012-09-04 13:54:16 +02:00
parent fdfaa0f5cf
commit 1974375c92
4 changed files with 40 additions and 19 deletions

View File

@ -267,16 +267,27 @@
<field name="arch" type="xml">
<form string="Interview Appraisal" version="7.0">
<header>
<button string="Cancel" name="survey_req_cancel" states="draft,waiting_answer" type="object" icon="gtk-cancel"/>
<button name="action_print_survey" string="Print Survey" type="object" states="draft" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}" attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" class="oe_highlight"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to"/>
<button string="Cancel" name="survey_req_cancel" type="object"
states="draft,waiting_answer"/>
<button string="Print Survey" name="action_print_survey" type="object"
states="draft" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}"
attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Send Request" name="survey_req_waiting_answer" type="object"
states="draft" class="oe_highlight"/>
<button string="Answer Survey" name="%(survey.action_view_survey_question_message)d" type="action"
states="waiting_answer"
context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}"
attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Done" name="survey_req_done" type="object"
states="waiting_answer"/>
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
</header>
<sheet>
<div class="oe_right oe_button_box" name="button_box">
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action" states="waiting_answer"/>
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" type="action"
states="waiting_answer"
context="{'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey' }"/>
</div>
<group>
<group col="3" colspan="1">

View File

@ -135,7 +135,8 @@ class mail_message(osv.Model):
_defaults = {
'type': 'email',
'date': lambda *a: fields.datetime.now(),
'author_id': _get_default_author
'author_id': lambda s,cr,uid,ctx={}: self._get_default_author(cr, uid, ctx),
'body': '',
}
#------------------------------------------------------

View File

@ -106,7 +106,7 @@ class mail_compose_message(osv.TransientModel):
'mail_compose_message_ir_attachments_rel',
'wizard_id', 'attachment_id', 'Attachments'),
'filter_id': fields.many2one('ir.filters', 'Filters'),
'body_text': fields.text('Plain-text editor body'),
'body_text': fields.text('Plain-text Contents'),
'content_subtype': fields.char('Message content subtype', size=32, readonly=1,
help="Type of message, usually 'html' or 'plain', used to select "\
"plain-text or rich-text contents accordingly"),

View File

@ -6,34 +6,43 @@
<field name="model">mail.compose.message</field>
<field name="arch" type="xml">
<form string="Compose Email" version="7.0">
<field name="composition_mode" nolabel="1" invisible="1"/>
<field name="model" nolabel="1" invisible="1"/>
<field name="res_id" nolabel="1" invisible="1"/>
<field name="parent_id" nolabel="1" invisible="1"/>
<field name="content_subtype" nolabel="1" invisible="1"/>
<group>
<field name="composition_mode" invisible="1"/>
<field name="model" invisible="1"/>
<field name="res_id" invisible="1"/>
<field name="author_id"/>
<field name="partner_ids"/>
<field name="subject" widget="char" size="512"/>
<field name="message_id"/>
<field name="subject" placeholder="Subject..."/>
<field name="partner_ids" widget="many2many_tags" placeholder="Add contacts to notify..."
context="{'force_create':True}"
on_change="onchange_partner_ids(partner_ids)"/>
</group>
<notebook colspan="4">
<notebook>
<page string="Body">
<field name="body" colspan="4" nolabel="1" height="300" width="300"/>
<field name="body_text" nolabel="1"
attrs="{'invisible':[('content_subtype', '=', 'html')]}"/>
<field name="body" nolabel="1"
attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" nolabel="1"/>
</page>
</notebook>
<footer>
<button name="send_mail" string="Send" type="object" class="oe_highlight" />
<button string="Send" name="send_mail" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
<div class="oe_right">
<button string="" name="toggle_content_subtype" type="object" icon="/mail/static/src/img/formatting.png"
help="Toggle advanced formatting mode"/>
</div>
</footer>
</form>
</field>
</record>
<record model="ir.ui.view" id="email_compose_message_wizard_form_chatter">
<field name="name">mail.compose.message.form</field>
<field name="name">mail.compose.message.form.chatter</field>
<field name="model">mail.compose.message</field>
<field name="priority">18</field>
<field name="arch" type="xml">