diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 8943cafa975..35afac5a508 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -436,7 +436,7 @@ class account_invoice(osv.osv): if t['state'] in ('draft', 'cancel') and t['internal_number']== False: unlink_ids.append(t['id']) else: - raise osv.except_osv(_('Invalid Action!'), _('You cannot delete an invoice which is open or paid. You should refund it instead.')) + raise osv.except_osv(_('Invalid Action!'), _('You can not delete an invoice which is not cancelled. You should refund it instead.')) osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 4feb97c2f5f..d3697b13ea9 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -436,7 +436,7 @@
The accounting features are fully integrated with other OpenERP applications to automate all your processes: creation of customer invoices, control of supplier invoices, point-of-sale integration, automated follow-ups, etc.
]]>You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability. For advanced accounting features, you should install the "Accounting and Finance" module.
]]>To manage quotations and sale orders, install the "Sales Management" application.
]]>Admin\n' - _body_html2 = 'I am angry !\n
Admin\n' + _body_html1 = 'Fans of Pigs, unite !\n
Admin
\n' + _body_html2 = 'I am angry !\nAdmin
\n' _attachments = [ {'name': 'First', 'datas_fname': 'first.txt', 'datas': base64.b64encode('My first attachment')}, {'name': 'Second', 'datas_fname': 'second.txt', 'datas': base64.b64encode('My second attachment')} diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 079ac5e388a..06d8cc1ee91 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -25,6 +25,21 @@ from osv import osv from osv import fields +def _reopen(self, res_id, model): + return {'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'view_type': 'form', + 'res_id': res_id, + 'res_model': self._name, + 'target': 'new', + # save original model in context, because selecting the list of available + # templates requires a model in context + 'context': { + 'default_model': model, + }, + } + + class mail_compose_message(osv.TransientModel): _inherit = 'mail.compose.message' @@ -42,10 +57,8 @@ class mail_compose_message(osv.TransientModel): else: model = context.get('default_model', context.get('active_model')) - if model: - record_ids = email_template_obj.search(cr, uid, [('model', '=', model)], context=context) - return email_template_obj.name_get(cr, uid, record_ids, context) + [(False, '')] - return [] + record_ids = email_template_obj.search(cr, uid, [('model', '=', model)], context=context) + return email_template_obj.name_get(cr, uid, record_ids, context) + [(False, '')] def default_get(self, cr, uid, fields, context=None): if context is None: @@ -110,7 +123,7 @@ class mail_compose_message(osv.TransientModel): onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])] onchange_res['attachment_ids'] = [(4, attachment_id) for attachment_id in onchange_res.pop('attachment_ids', [])] record.write(onchange_res) - return True + return _reopen(self, record.id, record.model) def onchange_use_template(self, cr, uid, ids, use_template, template_id, composition_mode, model, res_id, context=None): """ onchange_use_template (values: True or False). If use_template is @@ -142,8 +155,8 @@ class mail_compose_message(osv.TransientModel): 'attachment_ids': [(6, 0, [att.id for att in record.attachment_ids])] } template_id = email_template.create(cr, uid, values, context=context) - record.write({'template_id': template_id, 'use_template': True}) - return True + record.write(record.onchange_template_id(True, template_id, record.composition_mode, record.model, record.res_id)['value']) + return _reopen(self, record.id, record.model) #------------------------------------------------------ # Wizard validation and send diff --git a/addons/email_template/wizard/mail_compose_message_view.xml b/addons/email_template/wizard/mail_compose_message_view.xml index 0a530299d4a..5afaf9745e1 100644 --- a/addons/email_template/wizard/mail_compose_message_view.xml +++ b/addons/email_template/wizard/mail_compose_message_view.xml @@ -14,12 +14,11 @@