diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 5e5ac5f482b..98379f67240 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -202,7 +202,8 @@ class account_invoice(osv.osv): ('draft','Draft'), ('proforma','Pro-forma'), ('proforma2','Pro-forma'), - ('open','Open'), + ('open','Validated'), + ('sent','Sent'), ('paid','Paid'), ('cancel','Cancelled') ],'State', select=True, readonly=True, @@ -370,6 +371,27 @@ class account_invoice(osv.osv): _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise orm.except_orm(_('Unknown Error'), str(e)) + + def invoice_sent(self, cr, uid, ids, *args): + email_template_obj = self.pool.get('email.template') + mod_obj = self.pool.get('ir.model.data') + + template_id = email_template_obj.search(cr, uid, [('name', '=', 'Automated Invoice Notification Mail')])[0] + template = email_template_obj.browse(cr, uid, template_id) + model_data_id = mod_obj._get_id(cr, uid, 'mail', 'email_compose_message_wizard_form') + res_id = mod_obj.browse(cr, uid, model_data_id).res_id + + self.write(cr, uid, ids, {'state' : 'sent'}) + + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(res_id, 'form')], + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context':{'active_model':'account.invoice', 'mail.compose.template_id': template.id}, + } def confirm_paid(self, cr, uid, ids, context=None): if context is None: diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 59977c252f9..0aa7e48b6fc 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -299,16 +299,17 @@ - + - diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py index b108bc14fe3..006a622e25f 100644 --- a/addons/account_voucher/invoice.py +++ b/addons/account_voucher/invoice.py @@ -36,7 +36,7 @@ class invoice(osv.osv): 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', 'nodestroy': True, - 'target': 'current', + 'target': 'new', 'domain': '[]', 'context': { 'default_partner_id': inv.partner_id.id, diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 241bd23d5bb..43e316d1091 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -403,10 +403,10 @@ +