diff --git a/addons/account/i18n/pl.po b/addons/account/i18n/pl.po index 2305e11d469..48b88ee171d 100644 --- a/addons/account/i18n/pl.po +++ b/addons/account/i18n/pl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-05-03 04:03+0000\n" +"X-Launchpad-Export-Date: 2010-05-05 03:48+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po index f904e3f8d45..12e1bb3bf30 100644 --- a/addons/account/i18n/zh_CN.po +++ b/addons/account/i18n/zh_CN.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.6\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-03-29 00:34+0000\n" -"Last-Translator: digitalsatori \n" +"PO-Revision-Date: 2010-05-03 05:57+0000\n" +"Last-Translator: KenSai \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-04-17 04:08+0000\n" +"X-Launchpad-Export-Date: 2010-05-05 03:48+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index 6b1a41f49af..c3934e38db0 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -21,6 +21,7 @@ from osv import fields, osv from tools.translate import _ import netsvc +import pooler class account_invoice_confirm(osv.osv_memory): """ @@ -34,7 +35,12 @@ class account_invoice_confirm(osv.osv_memory): wf_service = netsvc.LocalService('workflow') if context is None: context = {} - for id in context['active_ids']: + pool_obj = pooler.get_pool(cr.dbname) + data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) + + for record in data_inv: + if record['state'] not in ('draft','proforma','proforma2'): + raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!")) wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr) return {} @@ -47,14 +53,19 @@ class account_invoice_cancel(osv.osv_memory): """ _name = "account.invoice.cancel" - _description = "Cancel the selected invoices" + _description = "Cancel the Selected Invoices" def invoice_cancel(self, cr, uid, ids, context=None): - wf_service = netsvc.LocalService('workflow') if context is None: context = {} - for id in context['active_ids']: - wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr) + wf_service = netsvc.LocalService('workflow') + pool_obj = pooler.get_pool(cr.dbname) + data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) + + for record in data_inv: + if record['state'] in ('cancel','paid'): + raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!")) + wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_cancel', cr) return {} account_invoice_cancel() diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml index 8748edbb688..d83c0c6f2dc 100644 --- a/addons/account/wizard/account_invoice_state_view.xml +++ b/addons/account/wizard/account_invoice_state_view.xml @@ -6,10 +6,10 @@ account.invoice.confirm form -
- + + -