import operator from osv import osv, fields from osv.orm import intersect import tools.sql from tools import config from tools.translate import _ from mx import DateTime import netsvc FORM = UpdateableStr() Fields=UpdateableDict() Forms=UpdateableStr() confirm_form=UpdateableStr() Form_error=UpdateableStr() Form_error.string='''<form string='Error'> <label>You must input Job Code and Job Name</label> </form>''' confirm_form.string='''<form string="Warning"> <separator string="Are you sure insert new Sub Job?"/> <!--<field name='owner1' invisible="1"/>--> </form>''' #confirm_fields={'owner1': {'string': 'Owner', 'type': 'many2one', 'relation': 'res.partner'}} def _check(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) sale_obj = pool.get('sale.order') sale=sale_obj.browse(cr,uid,data['id'],context=context) project_e = sale.project_e_id project_m = sale.project_m_id
elif type == 'mysql': import MySQLdb tdb = MySQLdb.connect(host = host,port = port, db = db_name, user = user, passwd = password) elif type == 'oracle': import cx_Oracle tdb = cx_Oracle.connect(user, password, host) except Exception, e: return_str = e.message _arch = ['''<?xml version="1.0"?>''', '''<form string="Connection Status">'''] _arch.append('''<label string='%s' />''' % (return_str)) _arch.append('''</form>''') _connection_arch.string = '\n'.join(_arch) return {} class wizard_test_connection(wizard.interface): states = { 'init': { 'actions': [_test_connection], 'result': {'type':'form', 'arch': _connection_arch, 'fields':{}, 'state':[('end','Ok')]} }, } wizard_test_connection('olap.fact.database.test_connection')
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## import wizard,osv,pooler from tools.misc import UpdateableStr, UpdateableDict from tools.translate import _ import netsvc VAR_FORM = UpdateableStr() VAR_FIELDS = UpdateableDict() VAR_FORM.string = u"""<?xml version="1.0"?> <form string="Incompatible application"> <separator string="The wizard will close immediately" colspan="4"/> </form> """ class wiz_tabs_setup(wizard.interface): def _action_idle(self, cr, uid, data, context): return { } def _action_inits(self, cr, uid, data, context): netsvc.Logger().notifyChannel( 'wiz_tabs_setup() called', netsvc.LOG_DEBUG, " Context="+str(context) ) VAR_FIELDS.dict = {}
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## import wizard, osv, pooler from tools.misc import UpdateableStr, UpdateableDict from tools.translate import _ import netsvc VAR_FORM = UpdateableStr() VAR_FIELDS = UpdateableDict() VAR_FORM.string = u"""<?xml version="1.0"?> <form string="Incompatible application"> <separator string="The wizard will close immediately" colspan="4"/> </form> """ class wiz_tabs_setup(wizard.interface): def _action_idle(self, cr, uid, data, context): return {} def _action_inits(self, cr, uid, data, context): netsvc.Logger().notifyChannel('wiz_tabs_setup() called', netsvc.LOG_DEBUG, " Context=" + str(context))
user=user, passwd=password) elif type == 'oracle': import cx_Oracle tdb = cx_Oracle.connect(user, password, host) except Exception, e: return_str = e.message _arch = [ '''<?xml version="1.0"?>''', '''<form string="Connection Status">''' ] _arch.append('''<label string='%s' />''' % (return_str)) _arch.append('''</form>''') _connection_arch.string = '\n'.join(_arch) return {} class wizard_test_connection(wizard.interface): states = { 'init': { 'actions': [_test_connection], 'result': { 'type': 'form', 'arch': _connection_arch, 'fields': {}, 'state': [('end', 'Ok')] } },