summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorced <>2007-09-11 14:14:15 +0000
committerced <>2007-09-11 14:14:15 +0000
commitb594c23c14a37183f79f85ff40dc8c10ecc43ad9 (patch)
tree97f3bd632b8c1b431e27f9c0c1e288a990b0b330 /doc
parentcde3a15d1d28fa064c69512a75d0312fee941b42 (diff)
Fix unit used in SO
- Now convert from the unit define in the product - Don't convert from unit to unit that are not in the same category - Fix SO report to print the right quantity - Improve coding guidelines - Add more digits to uom's factor bzr revid: ced-34db9376db2a0bc6920494e9e155fbff03a6d594
Diffstat (limited to 'doc')
-rw-r--r--doc/migrate/4.0.0-4.2.0/pre.py12
1 files changed, 12 insertions, 0 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 b5dc76c1d88..dc4c16099cd 100644
--- a/doc/migrate/4.0.0-4.2.0/pre.py
+++ b/doc/migrate/4.0.0-4.2.0/pre.py
@@ -171,4 +171,16 @@ if not cr.fetchall():
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()
+# ------------------------- #
+# change product_uom factor #
+# ------------------------- #
+
+cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = \'product_uom\' AND a.attname = \'factor\' AND c.oid = a.attrelid AND a.atttypid = t.oid AND t.typname = \'float8\'')
+if cr.fetchall():
+ cr.execute('ALTER TABLE product_uom RENAME COLUMN factor to temp_column')
+ cr.execute('ALTER TABLE product_uom ADD COLUMN factor NUMERIC(12,6)')
+ cr.execute('UPDATE product_uom SET factor = temp_column')
+ cr.execute('ALTER TABLE product_uom SET factor NOT NULL')
+ cr.execute('ALTER TABLE product_uom DROP COLUMN temp_column')
+
cr.close