[REVIEW] addons: small cleanups nex to a diff read. Some improvements will follow, this commit is about small cleanups.

bzr revid: tde@openerp.com-20120904092820-56zgwpkqfpd7as5k
This commit is contained in:
Thibault Delavallée 2012-09-04 11:28:20 +02:00
parent 48c081f271
commit c52ab94960
12 changed files with 31 additions and 35 deletions

View File

@ -12,4 +12,3 @@
self.message_update(cr, uid,[ref('crm_claim_4')], {'subject': 'Claim Update record','body': 'first training session completed',})
except:
pass

View File

@ -19,7 +19,7 @@
attrs="{'invisible':[('partner_assigned_id','=',False)]}"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action"
context="{'mail.compose.message.mode': 'forward', 'default_partner_ids': [partner_assigned_id]}"/>
context="{'default_composition_mode': 'forward', 'default_partner_ids': [partner_assigned_id]}"/>
</div>
</group>
<group string="Geo Assignation">

View File

@ -36,12 +36,12 @@ class crm_lead_forward_to_partner(osv.osv_memory):
if context is None:
context = {}
# set as comment, perform overrided document-like action that calls get_record_data
old_mode = context.get('mail.compose.message.mode', 'forward')
context['mail.compose.message.mode'] = 'comment'
old_mode = context.get('default_composition_mode', 'forward')
context['default_composition_mode'] = 'comment'
res = super(crm_lead_forward_to_partner, self).default_get(cr, uid, fields, context=context)
# back to forward mode
context['mail.compose.message.mode'] = old_mode
res['composition_mode'] = context['mail.compose.message.mode']
context['default_composition_mode'] = old_mode
res['composition_mode'] = context['default_composition_mode']
return res
def _get_composition_mode_selection(self, cr, uid, context=None):

View File

@ -51,7 +51,7 @@
key2="client_action_multi" name="Mass forward to partner"
res_model="crm.lead.forward.to.partner" src_model="crm.lead"
view_mode="form" target="new" view_type="form"
context="{'mail.compose.message.mode' : 'mass_mail'}"
context="{'default_composition_mode' : 'mass_mail'}"
view_id="crm_lead_forward_to_partner_form"
/>

View File

@ -171,7 +171,7 @@ class email_template(osv.osv):
'res_model': 'mail.compose.message',
'src_model': src_obj,
'view_type': 'form',
'context': "{'mail.compose.message.mode':'mass_mail', 'mail.compose.template_id' : %d}" % (template.id),
'context': "{'default_composition_mode': 'mass_mail', 'default_template_id' : %d}" % (template.id),
'view_mode':'form,tree',
'view_id': res_id,
'target': 'new',

View File

@ -388,22 +388,23 @@
action="action_hr_evaluation_interview_tree"/>
<!-- Email Compose message Action-->
<!-- TDE TODO: add context values -->
<act_window
id="evaluation_reminders" name="Appraisal Reminders"
res_model="mail.compose.message"
src_model="hr.evaluation.interview"
view_type="form" view_mode="form"
target="new" multi="True"
key2="client_action_multi"
context="{'mail.compose.message.mode':'mass_mail'}"/>
id="evaluation_reminders" name="Appraisal Reminders"
res_model="mail.compose.message"
src_model="hr.evaluation.interview"
view_type="form" view_mode="form"
target="new" multi="True"
key2="client_action_multi"
context="{'default_composition_mode': 'mass_mail'}"/>
<!-- Appraisal Interviews Button on Employee Form -->
<act_window
context="{'search_default_user_to_review_id': [active_id], 'default_user_to_review_id': active_id}"
id="act_hr_employee_2_hr__evaluation_interview"
name="Appraisal Interviews"
res_model="hr.evaluation.interview"
src_model="hr.employee"/>
context="{'search_default_user_to_review_id': [active_id], 'default_user_to_review_id': active_id}"
id="act_hr_employee_2_hr__evaluation_interview"
name="Appraisal Interviews"
res_model="hr.evaluation.interview"
src_model="hr.employee"/>
</data>
</openerp>

View File

@ -28,12 +28,8 @@ from osv import fields
from tools.translate import _
class mail_group(osv.Model):
"""
A mail_group is a collection of users sharing messages in a discussion
group. Group users are users that follow the mail group, using the
subscription/follow mechanism of OpenSocial. A mail group has nothing
in common with res.users.group.
"""
""" A mail_group is a collection of users sharing messages in a discussion
group. The group mechanics are based on the followers. """
_description = 'Discussion group'
_name = 'mail.group'
_inherit = ['mail.thread']

View File

@ -12,7 +12,7 @@
<div>
by <field name="author_id" class="oe_inline" string="User"/> on <field name="date" class="oe_inline"/>
<button name="%(action_email_compose_message_wizard)d" string="Reply" type="action" icon="terp-mail-replied"
context="{'mail.compose.message.mode':'reply', 'message_id':active_id}" states='received,sent,exception,cancel'/>
context="{'default_composition_mode':'reply', 'default_parent_id': active_id}" states='received,sent,exception,cancel'/>
</div>
<notebook colspan="4">
<page string="Message Details">

View File

@ -353,7 +353,7 @@ class test_mail(common.TransactionCase):
# CASE1: comment group_pigs with body_text and subject
compose_id = mail_compose.create(cr, uid,
{'subject': _subject, 'body_text': _body_text, 'partner_ids': [(4, p_c_id), (4, p_d_id)]},
{'mail.compose.message.mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id})
{'default_composition_mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id})
compose = mail_compose.browse(cr, uid, compose_id)
# Test: mail.compose.message: model, res_id
self.assertEqual(compose.model, 'mail.group', 'mail.compose.message incorrect model')
@ -378,7 +378,7 @@ class test_mail(common.TransactionCase):
message.write({'subject': _subject})
compose_id = mail_compose.create(cr, uid,
{'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])]},
{'mail.compose.message.mode': 'reply', 'default_model': 'mail.thread', 'default_res_id': self.group_pigs_id, 'active_id': message.id})
{'default_composition_mode': 'reply', 'default_model': 'mail.thread', 'default_res_id': self.group_pigs_id, 'default_parent_id': message.id})
compose = mail_compose.browse(cr, uid, compose_id)
# Test: form view methods

View File

@ -35,8 +35,7 @@ class mail_compose_message(osv.TransientModel):
""" Generic message composition wizard. You may inherit from this wizard
at model and view levels to provide specific features.
The behavior of the wizard can be modified through the context key
mail.compose.message.mode:
The behavior of the wizard depends on the composition_mode field:
- 'reply': reply to a previous message. The wizard is pre-populated
via ``get_message_data``.
- 'comment': new post on a record. The wizard is pre-populated via
@ -56,10 +55,11 @@ class mail_compose_message(osv.TransientModel):
- default_model or active_model
- default_res_id or active_id
- reply: active_id of a message the user replies to
- active_id: ID of a mail.message to which we are replying
- default_parent_id or message_id or active_id: ID of the
mail.message we reply to
- message.res_model or default_model
- message.res_id or default_res_id
- mass_mailing mode: model and IDs of records the user mass-mails
- mass_mail: model and IDs of records the user mass-mails
- active_ids: record IDs
- default_model or active_model
"""

View File

@ -64,7 +64,7 @@
</record>
<!-- Tranisition -->
<!-- Transition -->
<record id="marketing_campaign_transition_0" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_0"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_1"/>

View File

@ -732,7 +732,7 @@ class purchase_order(osv.osv):
# --------------------------------------
def needaction_domain_get(self, cr, uid, ids, context=None):
return [('state','=','draft')]
return [('state', '=', 'draft')]
def create_send_note(self, cr, uid, ids, context=None):
return self.message_post(cr, uid, ids, body=_("Request for quotation <b>created</b>."), context=context)