summaryrefslogtreecommitdiff
path: root/doc/migrate
diff options
context:
space:
mode:
authorced <>2006-12-14 16:00:46 +0000
committerced <>2006-12-14 16:00:46 +0000
commitb975013dfc705c8fdc92a150db7cd43ae3f46e4c (patch)
treee162305f8f27a68d857469083514568c7ee57050 /doc/migrate
parent5b327ad4e2df0a81029288af37eea6211e7c68f5 (diff)
Fix migration
bzr revid: ced-539157ddab355ba286593227b2223a0bd23dc2d4
Diffstat (limited to 'doc/migrate')
-rw-r--r--doc/migrate/3.3.0-3.4.0/post.py14
-rw-r--r--doc/migrate/3.3.0-3.4.0/pre.py9
-rw-r--r--doc/migrate/3.4.0-4.0.0/README25
-rw-r--r--doc/migrate/3.4.0-4.0.0/pre.py5
4 files changed, 46 insertions, 7 deletions
diff --git a/doc/migrate/3.3.0-3.4.0/post.py b/doc/migrate/3.3.0-3.4.0/post.py
index cd50c61fc3b..d890b3dccba 100644
--- a/doc/migrate/3.3.0-3.4.0/post.py
+++ b/doc/migrate/3.3.0-3.4.0/post.py
@@ -85,9 +85,13 @@ cr.execute("select company_id from res_users where company_id is not null limit
company_id = cr.fetchone()[0]
# get partners
-
-cr.execute("select id, payment_term from res_partner where payment_term is not null")
-partners = cr.dictfetchall()
+cr.execute("SELECT c.relname FROM pg_class c, pg_attribute a WHERE c.relname='res_partner' AND a.attname='payment_term' AND c.oid=a.attrelid")
+partners=[]
+drop_payment_term=False
+if cr.rowcount:
+ drop_payment_term=True
+ cr.execute("select id, payment_term from res_partner where payment_term is not null")
+ partners = cr.dictfetchall()
# loop over them
@@ -100,7 +104,9 @@ for partner in partners:
('property_payment_term', value, res_id, company_id, fields_id))
# remove the field
-cr.execute("alter table res_partner drop column payment_term")
+if drop_payment_term:
+ cr.execute("alter table res_partner drop column payment_term")
+cr.execute("delete from ir_model_fields where model = 'res.partner' and name = 'payment_term'")
cr.commit()
diff --git a/doc/migrate/3.3.0-3.4.0/pre.py b/doc/migrate/3.3.0-3.4.0/pre.py
index 5e47c519bfd..957fef586c0 100644
--- a/doc/migrate/3.3.0-3.4.0/pre.py
+++ b/doc/migrate/3.3.0-3.4.0/pre.py
@@ -102,9 +102,14 @@ for line in (
"alter table ir_model_fields add group_name varchar(64)",
"alter table ir_model_fields add view_load boolean",
"alter table ir_model_fields alter group_name set default ''",
- "alter table ir_model_fields alter view_load set default False"
+ "alter table ir_model_fields alter view_load set default False",
+ "delete from ir_values where value like '%,False'",
):
- cr.execute(line)
+ try:
+ cr.execute(line)
+ except psycopg.ProgrammingError, e:
+ cr.commit()
+ print e
cr.commit()
cr.close()
diff --git a/doc/migrate/3.4.0-4.0.0/README b/doc/migrate/3.4.0-4.0.0/README
new file mode 100644
index 00000000000..bf51831fef6
--- /dev/null
+++ b/doc/migrate/3.4.0-4.0.0/README
@@ -0,0 +1,25 @@
+This document describes the steps to follow to migrate from a version 3.4.0 of Tiny ERP server to a version 4.0.0
+
+Warning: the migration scripts involved in this migration are only meant for
+a standard Tiny ERP installation. It might not work or even break some data
+if you added or modified some code to the default Tiny ERP distribution.
+
+To migrate a 3.4.0 server to version 4.0.0 you should:
+
+- stop Tiny ERP server 3.4.0
+
+- backup your database
+ For example: pg_dump terp340 > backup340.sql
+
+- run the pre.py script (located in this directory)
+ You might need to pass it some optional arguments so that it can connect
+ to the database.
+
+ For example: python pre.py -d terp340
+
+- run TinyERP server 4.0.0 with "-d terp340 -u all" in the parameters
+ For example: ./tinyerp-server.py -d terp340 -u all
+
+- stop TinyERP server 4.0.0
+
+- you are ready to work with the new version.
diff --git a/doc/migrate/3.4.0-4.0.0/pre.py b/doc/migrate/3.4.0-4.0.0/pre.py
index 22c23bbf4db..9a533cad105 100644
--- a/doc/migrate/3.4.0-4.0.0/pre.py
+++ b/doc/migrate/3.4.0-4.0.0/pre.py
@@ -98,8 +98,11 @@ cr.commit()
# ----------------------------------------------------- #
for line in (
- "ALTER TABLE ir_module_module ADD demo BOOLEAN SET DEFAULT False",
+ "ALTER TABLE ir_module_module ADD demo BOOLEAN DEFAULT False",
+ "delete from ir_values where value like '%,False'",
+ """UPDATE ir_ui_view set arch='<?xml version="1.0"?><tree string="Menu" toolbar="1"><field icon="icon" name="name"/></tree>' where name='ir.ui.menu.tree' and type='tree' and field_parent='child_id'""",
):
cr.execute(line)
+cr.commit()
cr.close()