Skip to content

Commit

Permalink
Migration update for crm module change
Browse files Browse the repository at this point in the history
bzr revid: fp@tinyerp.com-a9432763a5041da0d4a694cf7171231b57a97490
  • Loading branch information
fpodoo committed Dec 17, 2007
1 parent 909e585 commit aa8c0e4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doc/migrate/4.0.0-4.2.0/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,26 @@
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

0 comments on commit aa8c0e4

Please sign in to comment.