Fix migration
bzr revid: ced-539157ddab355ba286593227b2223a0bd23dc2d4
This commit is contained in:
parent
5b327ad4e2
commit
b975013dfc
|
@ -85,7 +85,11 @@ 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 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()
|
||||
|
||||
|
@ -100,7 +104,9 @@ for partner in partners:
|
|||
('property_payment_term', value, res_id, company_id, fields_id))
|
||||
|
||||
# remove the field
|
||||
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()
|
||||
|
||||
|
|
|
@ -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'",
|
||||
):
|
||||
try:
|
||||
cr.execute(line)
|
||||
except psycopg.ProgrammingError, e:
|
||||
cr.commit()
|
||||
print e
|
||||
|
||||
cr.commit()
|
||||
cr.close()
|
||||
|
|
|
@ -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.
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue