~openerp-community/openobject-doc/ksa-openobject-doc-6.0

« back to all changes in this revision

Viewing changes to source/developer/5_18_upgrading_server/index.rst

  • Committer: Don Kirkby
  • Date: 2011-02-21 20:46:11 UTC
  • mfrom: (433.1.53 openobject-doc)
  • Revision ID: donkirkby+launpd@gmail.com-20110221204611-1ykt6dmg4k3gh5dh
[MERGE] revisions 477 to 486 from the 5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
Table/Object structure
54
54
""""""""""""""""""""""
55
55
 
56
 
When you run openerp-server with option --init or --update, the table structure are updated to match the new description that is in .py files. Fields that are removed are not removed in the postgresql database not to lose data.
57
 
 
58
 
So, simply running --update or --init, will upgrade your table structure.
59
 
 
60
 
It's important to run --init=module the first time you install the module. Next time, you must use the --update=module argument instead of the init one. This is because init loads ressources that are loaded only once and never upgraded (eg: ressources with no id="" attribute or within a noupdate="1" <data> tag).
61
 
 
 
56
When you run openerp-server with option ``--init`` or ``--update``, the table 
 
57
structure is updated to match the new description that is in Python code. Fields 
 
58
that are removed from Python code are not removed from the postgresql database 
 
59
to avoid losing data.
 
60
 
 
61
So, simply running with ``--update`` or ``--init``, will upgrade your table structure.
 
62
 
 
63
It's important to run ``--init=module`` the first time you install the module. 
 
64
Next time, you must use the ``--update=module`` argument instead of the init 
 
65
one. This is because ``--init`` loads resources that are loaded only once and 
 
66
never upgraded (i.e., resources with no ``id=""`` attribute or within a 
 
67
``<data noupdate="1">`` tag). The ``noupdate`` attribute can be overridden by
 
68
marking a record with ``forcecreate="True"``. This means that the record will be
 
69
created if it doesn't already exist in the database, but it won't be modified.
62
70
 
63
71
Data
64
72
""""
109
117
 
110
118
This will override the invoice form view. You do not have to delete the old view, like in 3.0 versions of OpenERP.
111
119
 
112
 
Note that it is often better to use view inherytancy instead of overwritting views.
113
 
 
114
 
In this migration system, you do not have to delete any ressource. The migration system will detect if it is an update or a delete using id="..." attributes. This is important to preserve references duing migrations.
115
 
 
116
 
Demo datas
 
120
Note that it is often better to use view inheritance instead of overwriting views.
 
121
 
 
122
In this migration system, you do not have to delete any resource. The migration system will detect if it is an update or a delete using id="..." attributes. This is important to preserve references duing migrations.
 
123
 
 
124
Demo data
117
125
""""""""""
118
126
 
119
 
Demo datas do not have to be upgraded; because they are probably modified, deleted, ... by users. So, to avoid demo data to be upgraded, you can put a noupdate="1" attribute in the <data> tag of your .xml data files.
 
127
Demo data do not have to be upgraded; because they are probably modified or 
 
128
deleted by users. So, to avoid demo data to be upgraded, you can put a 
 
129
``noupdate="1"`` attribute in the ``<data>`` tag of your .xml data files.
120
130
 
121
131
Summary of update and init process
122
132
++++++++++++++++++++++++++++++++++
123
133
 
124
134
init:
125
135
 
126
 
    modify/add/delete demo data and builtin data
 
136
    modify/add/delete demo data and built-in data
127
137
 
128
138
update:
129
139
 
130
 
    modifiy/add/delete non demo data
 
140
    modify/add/delete non demo data
131
141
 
132
 
Examples of builtin (non demo) data:
 
142
Examples of built-in (non demo) data:
133
143
 
134
144
    * Menu structure,
135
145
    * View definition,
136
146
    * Workflow description, ...
137
 
      -> Everything that as an id="..." in the .XML data declaration (if no attr noupdate="1" in the header)
 
147
    * Everything that has an `id` attribute in the XML data declaration (if no attr noupdate="1" in the header)
138
148
 
139
 
What's going on on a update process:
 
149
What's going on during the update process:
140
150
 
141
151
   1. If you manually added data within the client:
142
152
          * the update process will not change them
143
153
   2. If you dropped data:
144
154
          * if it was demo data, the update process will do nothing
145
 
          * it it was builtin data (like a view), the update process will recreate it
 
155
          * it it was built-in data (like a view), the update process will recreate it
146
156
   3. If you modified data (either in the .XML or the client):
147
157
          * if it's demo data: nothing
148
 
          * if it's builtin data, data are updated
149
 
   4. If builtin data have been deleted in the .XML file:
 
158
          * if it's built-in data, data are updated
 
159
   4. If built-in data have been deleted in the .XML file:
150
160
          * this data will be deleted in the database.
151
 
 
152