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/account_invoice_workflow.xml b/addons/account/account_invoice_workflow.xml
index 2af1e192a9b..58c4150a736 100644
--- a/addons/account/account_invoice_workflow.xml
+++ b/addons/account/account_invoice_workflow.xml
@@ -30,6 +30,14 @@ action_number()
write({'state':'open'})
function
+
+
+
+ sent
+ invoice_sent()
+ function
+
+
re-open
@@ -58,13 +66,30 @@ write({'state':'cancel'})
invoice_open
-
+
+
+
+ invoice_sent
+
+
account.move.line
move_line_id_payment_get()
test_paid()
+
+
+
+ account.move.line
+ move_line_id_payment_get()
+ test_paid()
+
+
+
+
+ invoice_cancel
+
@@ -86,6 +111,11 @@ write({'state':'cancel'})
invoice_cancel
+
+
+
+ invoice_sent
+
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 3ed173cca85..0a902fd48dc 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -772,7 +772,7 @@ class account_voucher(osv.osv):
def proforma_voucher(self, cr, uid, ids, context=None):
self.action_move_line_create(cr, uid, ids, context=context)
- return True
+ return {'type': 'ir.actions.act_window_close'}
def action_cancel_draft(self, cr, uid, ids, context=None):
wf_service = netsvc.LocalService("workflow")
diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml
index 345241cb4ee..f93da8d370f 100644
--- a/addons/account_voucher/account_voucher_pay_invoice.xml
+++ b/addons/account_voucher/account_voucher_pay_invoice.xml
@@ -8,7 +8,7 @@
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 @@
+
-
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 6c1571c5630..a6a2f9f2c82 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -56,6 +56,8 @@ class email_template(osv.osv):
:param str model: model name of the document record this mail is related to.
:param int res_id: id of the document record this mail is related to.
"""
+ if context is None:
+ context = {}
if not template: return u""
try:
template = tools.ustr(template)