From 039393f53e6df5daf7a2217d07d79a67a27cf4d6 Mon Sep 17 00:00:00 2001 From: ced <> Date: Fri, 13 Jul 2007 14:28:00 +0000 Subject: [PATCH] migration: add insert timezone in ir_value bzr revid: ced-53d4522144013019393cd3b494f07ad9811677ab --- doc/migrate/4.0.0-4.2.0/pre.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/migrate/4.0.0-4.2.0/pre.py b/doc/migrate/4.0.0-4.2.0/pre.py index 5d9d74ef3d8..b5dc76c1d88 100644 --- a/doc/migrate/4.0.0-4.2.0/pre.py +++ b/doc/migrate/4.0.0-4.2.0/pre.py @@ -154,7 +154,21 @@ cr.commit() # Drop state from hr_employee # # --------------------------- # -cr.execute('ALTER TABLE hr_employee DROP state') +cr.execute('SELECT * FROM pg_class c, pg_attribute a WHERE c.relname=\'hr_employee\' AND a.attname=\'state\' AND c.oid=a.attrelid') +if cr.fetchall(): + cr.execute('ALTER TABLE hr_employee DROP state') +cr.commit() + +# ------------ # +# Add timezone # +# ------------ # + +cr.execute('SELECT id FROM ir_values where model=\'res.users\' AND key=\'meta\' AND name=\'tz\'') +if not cr.fetchall(): + import pytz, pickle + meta = pickle.dumps({'type':'selection', 'string':'Timezone', 'selection': [(x, x) for x in pytz.all_timezones]}) + value = pickle.dumps(False) + cr.execute('INSERT INTO ir_values (name, key, model, meta, key2, object, value) VALUES (\'tz\', \'meta\', \'res.users\', %s, \'tz\', %s, %s)', (meta,False, value)) cr.commit() cr.close