diff --git a/addons/account_analytic_plans/__openerp__.py b/addons/account_analytic_plans/__openerp__.py
index b3067358a62..d2183563462 100644
--- a/addons/account_analytic_plans/__openerp__.py
+++ b/addons/account_analytic_plans/__openerp__.py
@@ -60,9 +60,9 @@ of distribution models.
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
- 'model_wizard.xml',
'account_analytic_plans_view.xml',
- 'account_analytic_plans_report.xml'
+ 'account_analytic_plans_report.xml',
+ 'wizard/analytic_plan_create_model_view.xml'
],
'demo_xml': [],
'installable': True,
diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py
index ea3dbdd0475..57acdb6dee5 100644
--- a/addons/account_analytic_plans/account_analytic_plans.py
+++ b/addons/account_analytic_plans/account_analytic_plans.py
@@ -145,7 +145,7 @@ class account_analytic_plan_instance(osv.osv):
return self.name_get(cr, uid, ids, context or {})
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- wiz_id = self.pool.get('ir.actions.wizard').search(cr, uid, [("wiz_name","=","create.model")])
+ wiz_id = self.pool.get('ir.actions.act_window').search(cr, uid, [("name","=","analytic.plan.create.model.action")])
res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
if (res['type']=='form'):
diff --git a/addons/account_analytic_plans/model_wizard.xml b/addons/account_analytic_plans/model_wizard.xml
deleted file mode 100644
index 9dc545b90a5..00000000000
--- a/addons/account_analytic_plans/model_wizard.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/account_analytic_plans/wizard/__init__.py b/addons/account_analytic_plans/wizard/__init__.py
index 4b47827094b..3da1c55b8bf 100644
--- a/addons/account_analytic_plans/wizard/__init__.py
+++ b/addons/account_analytic_plans/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,11 +15,11 @@
# 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 create_model
+import analytic_plan_create_model
import wizard_crossovered_analytic
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_analytic_plans/wizard/analytic_plan_create_model.py b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py
new file mode 100644
index 00000000000..aafaf986b51
--- /dev/null
+++ b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py
@@ -0,0 +1,56 @@
+# -*- 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
+from tools.translate import _
+
+class analytic_plan_create_model(osv.osv_memory):
+ _name = 'analytic.plan.create.model'
+ _description = 'analytic.plan.create.model'
+
+ def activate(self, cr, uid, ids, context=None):
+ plan_obj = self.pool.get('account.analytic.plan.instance')
+ mod_obj = self.pool.get('ir.model.data')
+ if 'active_id' in context and context['active_id']:
+ plan = plan_obj.browse(cr, uid, context['active_id'], context=context)
+ if (not plan.name) or (not plan.code):
+ raise osv.except_osv(_('Error'), _('Please put a name and a code before saving the model !'))
+ pids = self.pool.get('account.analytic.plan').search(cr, uid, [], context=context)
+ if (not pids):
+ raise osv.except_osv(_('Error'), _('No analytic plan defined !'))
+ plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]})
+
+ model_data_ids = mod_obj.search(cr,uid,[('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Distribution Model Saved'),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'analytic.plan.create.model',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+ else:
+ return {}
+
+analytic_plan_create_model()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_analytic_plans/wizard/analytic_plan_create_model_view.xml b/addons/account_analytic_plans/wizard/analytic_plan_create_model_view.xml
new file mode 100644
index 00000000000..75ef07e0098
--- /dev/null
+++ b/addons/account_analytic_plans/wizard/analytic_plan_create_model_view.xml
@@ -0,0 +1,53 @@
+
+
+
+
+ analytic.plan.create.model.msg.form
+ analytic.plan.create.model
+ form
+
+
+
+
+
+
+ analytic.plan.create.model.form
+ analytic.plan.create.model
+ form
+
+
+
+
+
+
+
+ analytic.plan.create.model.action
+ ir.actions.act_window
+ analytic.plan.create.model
+ form
+ form
+ new
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account_analytic_plans/wizard/create_model.py b/addons/account_analytic_plans/wizard/create_model.py
deleted file mode 100644
index 4c6ecce38c3..00000000000
--- a/addons/account_analytic_plans/wizard/create_model.py
+++ /dev/null
@@ -1,71 +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
-import time
-import netsvc
-import pooler
-from tools.translate import _
-
-info = '''
-'''
-
-
-def activate(self, cr, uid, data, context):
- plan_obj = pooler.get_pool(cr.dbname).get('account.analytic.plan.instance')
- if data['id']:
- plan = plan_obj.browse(cr, uid, data['id'], context)
- if (not plan.name) or (not plan.code):
- raise wizard.except_wizard(_('Error'), _('Please put a name and a code before saving the model !'))
- pids = pooler.get_pool(cr.dbname).get('account.analytic.plan').search(cr, uid, [], context=context)
- if (not pids):
- raise wizard.except_wizard(_('Error'), _('No analytic plan defined !'))
- plan_obj.write(cr,uid,[data['id']],{'plan_id':pids[0]})
- return 'info'
- else:
- return 'endit'
-
-def _do_nothing(self, cr, uid, data, context):
- return 1
-
-class create_model(wizard.interface):
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'choice','next_state':activate}
- },
- 'info': {
- 'actions': [],
- 'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
- },
- 'endit': {
- 'actions': [],
- 'result': {'type':'action','action':_do_nothing , 'state':'end'} #FIXME: check
- },
- }
-create_model('create.model')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-