diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index a9e5949a3ca..e89a52aa0e5 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -515,7 +515,7 @@ property or property parameter."), sub, body, attachments=attach and {'invitation.ics': attach} or None, - subtype='html', + content_subtype='html', reply_to=email_from, context=context ) diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 22786998f96..bc0a9e6cf3d 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -85,7 +85,6 @@ Creates a dashboard for CRM that includes: 'wizard/crm_opportunity_to_phonecall_view.xml', 'wizard/crm_partner_to_opportunity_view.xml', - 'wizard/crm_add_note_view.xml', 'wizard/crm_merge_opportunities_view.xml', 'crm_view.xml', diff --git a/addons/crm/security/ir.model.access.csv b/addons/crm/security/ir.model.access.csv index 5665839f365..91e5f1c1769 100644 --- a/addons/crm/security/ir.model.access.csv +++ b/addons/crm/security/ir.model.access.csv @@ -24,13 +24,11 @@ access_crm_phonecall_report_user,crm.phonecall.report.user,model_crm_phonecall_r access_crm_phonecall_report_manager,crm.phonecall.report,model_crm_phonecall_report,base.group_sale_manager,1,1,1,1 access_res_partner_manager,res.partner.crm.manager,base.model_res_partner,base.group_sale_manager,1,0,0,0 access_res_partner_category_manager,res.partner.category.crm.manager,base.model_res_partner_category,base.group_sale_manager,1,0,0,0 -mail_mail_message_manager,mail.message.manager,mail.model_mail_message,base.group_sale_manager,1,0,0,0 access_calendar_attendee_crm_user,calendar.attendee.crm.user,model_calendar_attendee,base.group_sale_salesman,1,1,1,0 access_calendar_attendee_crm_manager,calendar.attendee.crm.manager,model_calendar_attendee,base.group_sale_manager,1,1,1,1 access_res_partner,res.partner.crm.user,base.model_res_partner,base.group_sale_salesman,1,1,1,0 access_res_partner_category,res.partner.category.crm.user,base.model_res_partner_category,base.group_sale_salesman,1,1,1,0 mail_mailgate_thread,mail.thread,mail.model_mail_thread,base.group_sale_salesman,1,1,1,1 -mail_gateway_mail_message_user,mail.message.user,mail.model_mail_message,base.group_sale_salesman,1,1,1,1 access_crm_case_categ_manager,crm.case.categ manager,model_crm_case_categ,base.group_sale_manager,1,1,1,1 access_base_action_rule_manager,base.action.rule manager,model_base_action_rule,base.group_sale_manager,1,1,1,1 access_crm_lead_report_user,crm.lead.report user,model_crm_lead_report,base.group_sale_salesman,1,1,1,1 diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index 1c2cfdeb605..a3e7fac372a 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -54,10 +54,8 @@ - After communicated with customer, I put some notes with contract details. - - !python {model: crm.add.note}: | - context.update({'active_model': 'crm.lead', 'active_id': ref('crm_case_qrecorp0')}) - note_id = self.create(cr, uid, {'body': "ces détails envoyés par le client sur ​​le FAX pour la qualité"}) - self.action_add(cr, uid, [note_id], context=context) + !python {model: crm.lead}: | + self.message_append_note(cr, uid, [ref('crm_case_qrecorp0')], subject='Test note', body='ces détails envoyés par le client sur ​​le FAX pour la qualité') - I win this opportunity - diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index 9d128492422..15ca8df670d 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -19,8 +19,6 @@ # ############################################################################## -import crm_add_note - import crm_lead_to_partner import crm_lead_to_opportunity import crm_phonecall_to_phonecall diff --git a/addons/crm/wizard/crm_add_note.py b/addons/crm/wizard/crm_add_note.py deleted file mode 100644 index 02f592f0136..00000000000 --- a/addons/crm/wizard/crm_add_note.py +++ /dev/null @@ -1,53 +0,0 @@ -from .. import crm -from osv import fields, osv -from tools.translate import _ -from mail.mail_message import truncate_text - -AVAILABLE_STATES = crm.AVAILABLE_STATES + [('unchanged', 'Unchanged')] - -class crm_add_note(osv.osv_memory): - """Adds a new note to the case.""" - _name = 'crm.add.note' - _description = "Add Internal Note" - - _columns = { - 'body': fields.text('Note Body', required=True), - 'state': fields.selection(AVAILABLE_STATES, string='Set New State To', - required=True), - } - - _defaults = { - 'state': 'unchanged' - } - - def action_add(self, cr, uid, ids, context=None): - if context is None: - context = {} - - if not context.get('active_model'): - raise osv.except_osv(_('Error'), _('Can not add note!')) - - model = context.get('active_model') - case_pool = self.pool.get(model) - - for obj in self.browse(cr, uid, ids, context=context): - case_list = case_pool.browse(cr, uid, context['active_ids'], - context=context) - case = case_list[0] - case_pool.message_append(cr, uid, [case], truncate_text(obj.body), - body_text=obj.body) - if obj.state == 'unchanged': - pass - elif obj.state == 'done': - case_pool.case_close(cr, uid, [case.id]) - elif obj.state == 'draft': - case_pool.case_reset(cr, uid, [case.id]) - elif obj.state in ['cancel', 'open', 'pending']: - act = 'case_' + obj.state - getattr(case_pool, act)(cr, uid, [case.id]) - - return {'type': 'ir.actions.act_window_close'} - -crm_add_note() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/wizard/crm_add_note_view.xml b/addons/crm/wizard/crm_add_note_view.xml deleted file mode 100644 index fc4b57f85dc..00000000000 --- a/addons/crm/wizard/crm_add_note_view.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - crm.new.add.note.form - crm.add.note - form - -
- - - - -
-
-
-
-
- - - - - Add Note - crm.add.note - form - form - - new - - -
-
- diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index c4ed2eedb85..bf57342f14f 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -101,6 +101,11 @@ class email_template(osv.osv): mod_name = self.pool.get('ir.model').browse(cr, uid, model_id, context).model return {'value':{'model': mod_name}} + def name_get(self, cr, uid, ids, context=None): + """ Override name_get of mail.message: return directly the template + name, and not the generated name from mail.message.common.""" + return [(record.id, record.name) for record in self.browse(cr, uid, ids, context=context)] + _columns = { 'name': fields.char('Name', size=250), 'model_id': fields.many2one('ir.model', 'Related document model'), @@ -311,7 +316,7 @@ class email_template(osv.osv): 'attachment_ids': False, 'message_id': False, 'state': 'outgoing', - 'subtype': 'plain', + 'content_subtype': 'plain', } if not template_id: return values @@ -326,8 +331,15 @@ class email_template(osv.osv): template.model, res_id, context=context) \ or False + # if email_to: find or create a partner + if values['email_to']: + partner_id = self.pool.get('mail.thread').message_partner_by_email(cr, uid, values['email_to'], context=context)['partner_id'] + if not partner_id: + partner_id = self.pool.get('res.partner').name_create(cr, uid, values['email_to'], context=context) + values['partner_ids'] = [partner_id] + if values['body_html']: - values.update(subtype='html') + values.update(content_subtype='html') if template.user_signature: signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature diff --git a/addons/email_template/static/src/img/email_template.png b/addons/email_template/static/src/img/email_template.png new file mode 100644 index 00000000000..d679492bc19 Binary files /dev/null and b/addons/email_template/static/src/img/email_template.png differ diff --git a/addons/email_template/static/src/img/email_template_save.png b/addons/email_template/static/src/img/email_template_save.png new file mode 100644 index 00000000000..bf29f9ab4ad Binary files /dev/null and b/addons/email_template/static/src/img/email_template_save.png differ diff --git a/addons/email_template/wizard/email_compose_message_view.xml b/addons/email_template/wizard/email_compose_message_view.xml index 96ea55da9e5..a911034cb1a 100644 --- a/addons/email_template/wizard/email_compose_message_view.xml +++ b/addons/email_template/wizard/email_compose_message_view.xml @@ -25,5 +25,32 @@ + + + mail.compose.message.form + mail.compose.message + form + + + + + + + + +