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
This commit is contained in:
ced 2007-09-11 14:14:15 +00:00
parent cde3a15d1d
commit b594c23c14
1 changed files with 12 additions and 0 deletions

View File

@ -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