summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorced <>2007-07-13 14:28:00 +0000
committerced <>2007-07-13 14:28:00 +0000
commit039393f53e6df5daf7a2217d07d79a67a27cf4d6 (patch)
tree0af5a7fa0f32959b4255b1cde115735f2901372f /doc
parent8a094005a0971546f173c8a9230e2c16eef5e839 (diff)
migration: add insert timezone in ir_value
bzr revid: ced-53d4522144013019393cd3b494f07ad9811677ab
Diffstat (limited to 'doc')
-rw-r--r--doc/migrate/4.0.0-4.2.0/pre.py16
1 files changed, 15 insertions, 1 deletions
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