[MERGE] wizard: add a deprecation warning for the old-style wizards.

bzr revid: vmt@openerp.com-20111201124822-0e9illtpfmd58k40
This commit is contained in:
Vo Minh Thu 2011-12-01 13:48:22 +01:00
commit 1b2439c27a
1 changed files with 9 additions and 0 deletions

View File

@ -31,6 +31,7 @@ from openerp.osv.osv import except_osv
from openerp.osv.orm import except_orm
from openerp.netsvc import Logger, LOG_ERROR
import sys
import warnings
class except_wizard(Exception):
def __init__(self, name, value):
@ -39,10 +40,18 @@ class except_wizard(Exception):
self.args = (name, value)
class interface(netsvc.Service):
"""
This is the base class used to implement Wizards. This class is deprecated
and `openerp.osv.TransientModel` must be used instead.
"""
states = {}
def __init__(self, name):
assert not self.exists('wizard.'+name), 'The wizard "%s" already exists!' % (name,)
warnings.warn(
"The wizard %s uses the deprecated openerp.wizard.interface class.\n"
"It must use the openerp.osv.TransientModel class instead." % \
name, DeprecationWarning, stacklevel=3)
super(interface, self).__init__('wizard.'+name)
self.wiz_name = name