From 8082c6e4a3a41111c27d6362e7278b1d026fce2a Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 29 Feb 2012 12:17:05 +0530 Subject: [PATCH 1/2] [IMP] account, account_voucher : Improved workflow state name, button name and also the position,Open payment in new window (and close voucher when paid), added 'sent' state and its related changes. bzr revid: mdi@tinyerp.com-20120229064705-x1j7ll1yst2ez5mf --- addons/account/account_invoice.py | 24 +++++++++++++- addons/account/account_invoice_view.xml | 13 ++++---- addons/account/account_invoice_workflow.xml | 32 ++++++++++++++++++- addons/account_voucher/account_voucher.py | 2 +- .../account_voucher_pay_invoice.xml | 2 +- addons/account_voucher/invoice.py | 2 +- .../voucher_payment_receipt_view.xml | 2 +- addons/email_template/email_template.py | 2 ++ 8 files changed, 67 insertions(+), 12 deletions(-) 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 @@ +