Migration update for crm module change

bzr revid: fp@tinyerp.com-a9432763a5041da0d4a694cf7171231b57a97490
This commit is contained in:
Fabien Pinckaers 2007-12-17 20:25:36 +00:00
parent 909e58578d
commit aa8c0e4ad9
1 changed files with 22 additions and 0 deletions

View File

@ -248,4 +248,26 @@ if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_wizard ADD PRIMARY KEY (id)')
cr.commit()
# ------------------------ #
# change currency rounding #
# ------------------------ #
cr.execute("""SELECT
c.relname,a.attname,a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,t.typname,CASE
WHEN a.attlen=-1 THEN a.atttypmod-4 ELSE a.attlen END as size FROM pg_class
c,pg_attribute a,pg_type t WHERE c.relname='crm_case' AND
a.attname='date_deadline' AND c.oid=a.attrelid AND a.atttypid=t.oid""")
res = cr.dictfetchall()
if res[0]['typname'] != 'timestamp':
for line in (
"ALTER TABLE crm_case RENAME date_deadline TO date_deadline_bak",
"ALTER TABLE crm_case ADD date_deadline timestamp",
"UPDATE crm_case SET date_deadline = date_deadline_bak",
"ALTER TABLE crm_case DROP date_deadline_bak",
):
cr.execute(line)
cr.commit()
cr.close