From b594c23c14a37183f79f85ff40dc8c10ecc43ad9 Mon Sep 17 00:00:00 2001 From: ced <> Date: Tue, 11 Sep 2007 14:14:15 +0000 Subject: [PATCH] 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 --- doc/migrate/4.0.0-4.2.0/pre.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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