diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index a006cb10bab..a3813f47fee 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -50,6 +50,7 @@
"voucher_view.xml",
"voucher_wizard.xml",
"account_view.xml",
+ "wizard/account_voucher_open_view.xml",
],
'certificate': '0037580727101',
"active": False,
diff --git a/addons/account_voucher/voucher_wizard.xml b/addons/account_voucher/voucher_wizard.xml
index 5e8a3f6ce5d..661acdd4241 100644
--- a/addons/account_voucher/voucher_wizard.xml
+++ b/addons/account_voucher/voucher_wizard.xml
@@ -1,20 +1,20 @@
-
-
-
+
+ parent="menu_action_voucher_list"/> -->
diff --git a/addons/account_voucher/wizard/__init__.py b/addons/account_voucher/wizard/__init__.py
index 136fd1d8ee9..bd436ecd135 100644
--- a/addons/account_voucher/wizard/__init__.py
+++ b/addons/account_voucher/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,8 +15,8 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-import open_voucher
+import account_voucher_open
diff --git a/addons/account_voucher/wizard/account_voucher_open.py b/addons/account_voucher/wizard/account_voucher_open.py
new file mode 100644
index 00000000000..b286217e106
--- /dev/null
+++ b/addons/account_voucher/wizard/account_voucher_open.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from osv import osv, fields
+from tools.translate import _
+
+_types = {
+ 'pay_voucher':'Cash Payment Voucher',
+ 'bank_pay_voucher':'Bank Payment Voucher',
+ 'rec_voucher':'Cash Receipt Voucher',
+ 'bank_rec_voucher':'Bank Receipt Voucher',
+ 'cont_voucher':'Contra Voucher',
+ 'journal_sale_vou':'Journal Sale Voucher',
+ 'journal_pur_voucher':'Journal Purchase Voucher'
+ }
+_states = {
+ 'draft':'Draft',
+ 'proforma':'Pro-forma',
+ 'posted':'Posted',
+ 'cancel':'Cancel'
+ }
+
+class account_open_voucher(osv.osv_memory):
+ _name = "account.open.voucher"
+ _description = "Account Open Voucher"
+
+ _columns = {
+ 'type': fields.selection([('pay_voucher','Cash Payment Voucher'),
+ ('bank_pay_voucher','Bank Payment Voucher'),
+ ('rec_voucher','Cash Receipt Voucher'),
+ ('bank_rec_voucher','Bank Receipt Voucher'),
+ ('cont_voucher','Contra Voucher'),
+ ('journal_sale_vou','Journal Sale Voucher'),
+ ('journal_pur_voucher','Journal Purchase Voucher')],'Voucher Type', required=True),
+ 'state': fields.selection([('draft','Draft'),
+ ('proforma','Pro-forma'),
+ ('posted','Posted'),
+ ('cancel','Cancel')], 'State', required=True),
+ 'period_ids': fields.many2many('account.period', 'voucher_period_rel', 'voucher_id', 'period_id', 'Periods'),
+ }
+
+ def action_open_window(self, cr, uid, ids, context=None):
+ obj_period = self.pool.get('account.period')
+ obj_fyear = self.pool.get('account.fiscalyear')
+ periods = []
+ if context is None:
+ context = {}
+
+ form = self.read(cr, uid, ids, [])[0]
+ if not form['period_ids']:
+ year = obj_fyear.find(cr, uid)
+ periods = obj_period.search(cr, uid, [('fiscalyear_id','=',year)])
+ else:
+ periods = form['period_ids']
+ return {
+ 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
+ 'name': "%s - %s" % (_types[form['type']], _states[form['state']]),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.voucher',
+ 'view_id': False,
+ 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
+ 'type': 'ir.actions.act_window',
+ 'nodestroy': True
+ }
+
+account_open_voucher()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/account_voucher_open_view.xml b/addons/account_voucher/wizard/account_voucher_open_view.xml
new file mode 100644
index 00000000000..0d67c455c3f
--- /dev/null
+++ b/addons/account_voucher/wizard/account_voucher_open_view.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+ Open Vouchers
+ account.open.voucher
+ form
+
+
+
+
+
+
+ Open Vouchers
+ account.open.voucher
+ ir.actions.act_window
+ form
+ tree,form
+
+ {'record_id':active_id}
+ new
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/open_voucher.py b/addons/account_voucher/wizard/open_voucher.py
deleted file mode 100644
index 5a3892e1a14..00000000000
--- a/addons/account_voucher/wizard/open_voucher.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import wizard
-from tools.translate import _
-import pooler
-
-_voucher_form = '''
-'''
-
-_types = {
- 'pay_voucher':'Cash Payment Voucher',
- 'bank_pay_voucher':'Bank Payment Voucher',
- 'rec_voucher':'Cash Receipt Voucher',
- 'bank_rec_voucher':'Bank Receipt Voucher',
- 'cont_voucher':'Contra Voucher',
- 'journal_sale_vou':'Journal Sale Voucher',
- 'journal_pur_voucher':'Journal Purchase Voucher'
-}
-_states = {
- 'draft':'Draft',
- 'proforma':'Pro-forma',
- 'posted':'Posted',
- 'cancel':'Cancel'
-}
-
-_voucher_fields = {
- 'type': {'string':'Voucher Type', 'type':'selection', 'selection':[
- ('pay_voucher','Cash Payment Voucher'),
- ('bank_pay_voucher','Bank Payment Voucher'),
- ('rec_voucher','Cash Receipt Voucher'),
- ('bank_rec_voucher','Bank Receipt Voucher'),
- ('cont_voucher','Contra Voucher'),
- ('journal_sale_vou','Journal Sale Voucher'),
- ('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
- 'state': {'string':'State', 'type':'selection', 'selection':[
- ('draft','Draft'),
- ('proforma','Pro-forma'),
- ('posted','Posted'),
- ('cancel','Cancel')], 'required':True},
- 'period_ids': {'string':'Periods', 'type':'many2many', 'relation':'account.period'},
-}
-
-def _action_open_window(self, cr, uid, data, context):
- form = data['form']
- periods = []
-
- if not form['period_ids'][0][2]:
- pool = pooler.get_pool(cr.dbname)
- period = pool.get('account.period')
- year = pool.get('account.fiscalyear')
-
- year = year.find(cr, uid)
- periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
- else:
- periods = form['period_ids'][0][2]
-
- return {
- 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
- 'name': "%s - %s" % (_types[form['type']], _states[form['state']]),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.voucher',
- 'view_id': False,
- 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
- 'type': 'ir.actions.act_window'
- }
-
-class OpenVoucherEntries(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_voucher_form, 'fields':_voucher_fields, 'state':[('end','Cancel'),('open','Open Voucher Entries')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-OpenVoucherEntries('account.voucher.open')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: