12
12
.. i18n: ============================
15
Importing and exporting data
16
============================
15
Импорт и экспорт данных
16
=========================
18
.. i18n: Every form in Open ERP has a standard mechanism for importing data from a CSV file through the client user interface.
18
.. i18n: Every form in OpenERP has a standard mechanism for importing data from a CSV file through the client user interface.
19
19
.. i18n: That's the same format as used in the language translations.
22
Every form in Open ERP has a standard mechanism for importing data from a CSV file through the client user interface.
23
That's the same format as used in the language translations.
22
Каждая форма в OpenERP обладает стандартным механизмом для импорта данных из файла CSV через клиентский пользовательский интерфейс. Этот же формат используется в языковых переводах.
25
24
.. i18n: .. note:: Forms and Lists
30
29
.. i18n: :menuselection:`Form --> Import...` and :menuselection:`Form --> Export...`.
33
.. note:: Forms and Lists
32
.. note:: Формы и списки
35
You have access to the Import and Export functions in the web client on a single form view in read-
36
only mode – you can't reach Import or Export in any other view or when the form is editable.
37
If you're using the GTK client you can find the functions from the top menu
38
:menuselection:`Form --> Import...` and :menuselection:`Form --> Export...`.
34
В веб-клиенте у вас есть доступ к функциям импорта и экспорта на виде формы в режиме «только для чтения» -- вы не можете использовать импорт и экспорт в каком-либо другом виде или когда форма находится в режиме редактирования. Если вы используете клиент GTK, эти функции находятся в верхнем меню :menuselection:`[Форма --> Импорт...] (Form --> Import...)` и :menuselection:`[Форма --> Экспорт...] (Form --> Export...)`.
40
36
.. i18n: The CSV file format is a text format compatible with most spreadsheet programs (such as OpenOffice
41
37
.. i18n: Calc and Microsoft Excel) and is easily editable as a worksheet. The first line contains the name of
42
38
.. i18n: the field in the form. All the subsequent lines are data, aligned in their respective columns.
45
The CSV file format is a text format compatible with most spreadsheet programs (such as OpenOffice
46
Calc and Microsoft Excel) and is easily editable as a worksheet. The first line contains the name of
47
the field in the form. All the subsequent lines are data, aligned in their respective columns.
41
Формат файла CSV -- это текстовый формат, совместимый с большинством программ-табличных калькуляторов (таких, как OpenOffice Calc и Microsoft Excel) и легко редактируется как таблица. Первая строка содержит название полей формы. Все последующие строки -- это данные, помещенные в свои соответствующие столбцы.
49
43
.. i18n: .. index::
50
44
.. i18n: pair: data; CSV export
57
51
.. i18n: ------------------------------
60
Exporting OpenERP data to CSV
54
Экспорт данных OpenERP в CSV
61
55
------------------------------
63
57
.. i18n: Start exploring OpenERP's use of the CSV format by exporting a modestly complex set of data,
64
58
.. i18n: the partners and partner addresses in the demonstration data.
67
Start exploring OpenERP's use of the CSV format by exporting a modestly complex set of data,
68
the partners and partner addresses in the demonstration data.
61
Начните экспорт данных OpenERP в формат CSV с ограниченно сложного набора данных, контрагентов и адресов контрагентов в демонстрационных данных.
70
63
.. i18n: Go to :menuselection:`Partners --> Partners` for the list of partners and then scroll to the bottom
71
64
.. i18n: of the list to click the :guilabel:`Export` link. This pops up the :guilabel:`Export Data` dialog box.
72
65
.. i18n: Select the following fields:
75
Go to :menuselection:`Partners --> Partners` for the list of partners and then scroll to the bottom
76
of the list to click the :guilabel:`Export` link. This pops up the :guilabel:`Export Data` dialog box.
77
Select the following fields:
68
Перейдите в :menuselection:`[Контрагенты --> Контрагенты] (Partners --> Partners)`, чтобы получить список контрагентов и затем прокрутите экран до нижней части списка, чтобы нажать ссылку :guilabel:`[Экспорт] (Export)`. Это вызовет диалоговое окно :guilabel:`Экспорт данных (Export Data)`. Выберите следующие поля:
79
70
.. i18n: * :guilabel:`Name`,
83
74
.. i18n: * :guilabel:`City` under the :guilabel:`Contacts` menu.
88
* :guilabel:`Contact Name` under the :guilabel:`Contacts` menu,
90
* :guilabel:`City` under the :guilabel:`Contacts` menu.
77
* :guilabel:`Название (Name)`,
79
* :guilabel:`Имя контакта (Contact Name)` в меню :guilabel:`[Контакты] (Contacts)`,
81
* :guilabel:`Город (City)` в меню :guilabel:`[Контакты] (Contacts)`.
92
83
.. i18n: You can either select and add them one at a time, or :kbd:`Ctrl-click` them and add
93
84
.. i18n: the multiple selection - the order in which you
94
85
.. i18n: select them is the order in which they'll be displayed.
97
You can either select and add them one at a time, or :kbd:`Ctrl-click` them and add
98
the multiple selection - the order in which you
99
select them is the order in which they'll be displayed.
88
Вы можете либо выбирать и добавлять их по одному, либо щелкая левой кнопкой мыши при нажатой клавише :kbd:`<Ctrl>` и добавить затем множественный выбор -- поля будут перечислены в том порядке, в котором вы их выбирали.
101
90
.. i18n: Then click :guilabel:`Export` and save the resulting :file:`data.csv` file somewhere accessible -
102
91
.. i18n: perhaps your Desktop. You can open that file in a spreadsheet program or a text editor.
105
Then click :guilabel:`Export` and save the resulting :file:`data.csv` file somewhere accessible -
106
perhaps your Desktop. You can open that file in a spreadsheet program or a text editor.
94
Затем нажмите :guilabel:`[Экспорт] (Export)` и сохраните результирующий файл :file:`data.csv` где-либо в доступном месте, например -- на рабочем столе. Вы можете открыть этот файл в табличном калькуляторе или текстовом редакторе.
108
96
.. i18n: You'll see that you have a list of partners, with the name and city of each partner's contacts
109
97
.. i18n: alongside. In the couple of cases where there is more than one address, the partner name
129
114
.. i18n: then prepare to wait.
117
.. tip:: Ограничения списка
134
There is a limit to the number of items you can export in the clients - it's the number
135
you can actually see and that is limited to a maximum of 100 in the web client, but is
136
arbitrary in the GTK client.
119
На количество записей, которые вы можете экспортировать в клиентском ПО, существует ограничение -- это количество записей, которые вы можете реально видеть и ограничение равно максимум 100 записям в веб-клиенте, но может быть произвольно выбрано в клиенте GTK.
138
So if you want to export everything, use the GTK client. Set the export limit to an
139
arbitrarily large figure (using the :guilabel:`+` button to expose the
140
:guilabel:`Parameters` and :guilabel:`Limit` fields), then click
141
:menuselection:`Form --> Export data...`, set up the fields to export, and
142
then prepare to wait.
121
Так что если вы хотите экспортировать все, используйте клиент GTK. Установите лимит экспорта в достаточно большое значение (при помощи кнопки :guilabel:`[+]` для воздействия на :guilabel:`Параметры (Parameters)` и :guilabel:`Ограничения (Limit)`), затем нажмите :menuselection:`[Форма --> Экспорт данных...] (Form --> Export data...)`, задайте поля для экспорта, и приготовьтесь подождать.
144
123
.. i18n: .. index::
145
124
.. i18n: pair: data; CSV import
160
139
.. i18n: but the principle is the same for a blank database).
163
Use this export file as a template for an import file by deleting all of the data
164
and using new data (here you'll just import new data alongside the demonstration data,
165
but the principle is the same for a blank database).
142
Воспользуйтесь этим файлом экспорта как шаблоном для импорта файлов путем удаления всех данных и использованием новых данных (здесь вы можете просто импортировать новые данные рядом с демонстрационными данными, но для пустой базы данных принцип тот же).
167
144
.. i18n: For example, to import partners with several contacts for which you specify a name and a city, you
168
145
.. i18n: would create the following CSV file from the export file:
171
For example, to import partners with several contacts for which you specify a name and a city, you
172
would create the following CSV file from the export file:
148
Например, для импорта контрагентов, с несколькими контактами, для которых вы можете указать имя и город, вы можете создать следующий файл CSV из экспортированного файла:
174
150
.. i18n: .. csv-table:: Example of importing partner address fields
175
151
.. i18n: :header: "Name", "Contacts/Contact Name", "Contacts/City"
181
157
.. i18n: "Miles A Minute","",""
184
.. csv-table:: Example of importing partner address fields
185
:header: "Name", "Contacts/Contact Name", "Contacts/City"
160
.. csv-table:: Пример импорта адресных полей контрагента
161
:header: "Название (Name)", "Контакты/Имена контактов (Contacts/Contact Name)", "Контакты/Город (Contacts/City)"
188
"Whole Globe Technologies","Graham Global","Athens"
189
"","Wanda World","Rome"
190
"","Emerson Earth","New York"
164
"Whole Globe Technologies","Graham Global","Афины (Athens)"
165
"","Wanda World","Рим (Rome)"
166
"","Emerson Earth","Нью-Йорк (New York)"
191
167
"Miles A Minute","",""
193
169
.. i18n: From the list of partners, click the :guilabel:`Import` button and then in the
196
172
.. i18n: but the GTK client requires that you click the :guilabel:`Auto detect` button.
199
From the list of partners, click the :guilabel:`Import` button and then in the
200
:guilabel:`Import Data` window click :guilabel:`Open` to search for and import
201
the new :file:`data.csv` file. The web client automatically matches column names
202
but the GTK client requires that you click the :guilabel:`Auto detect` button.
175
В списке контрагентов нажмите кнопку :guilabel:`[Импорт] (Import)` и затем в окне :guilabel:`Импорт данных (Import Data)` нажмите :guilabel:`[Открыть] (Open)` для того, чтобы выбрать и импортировать новый файл :file:`data.csv`. Веб-клиент автоматически ставит соответствие по названиям колонок, но клиент GTK требует нажатия кнопки :guilabel:`[Автоопределение] (Auto detect)`.
204
177
.. i18n: You'll get a dialog box showing that you have imported 2 objects, and you can
205
178
.. i18n: see the new partners and partner addresses when you refresh the list on screen.
208
You'll get a dialog box showing that you have imported 2 objects, and you can
209
see the new partners and partner addresses when you refresh the list on screen.
181
Будет выведено диалоговое окно, показывающее, что вы импортировали 2 объекта, и теперь вы можете увидеть новых контрагентов и адреса контрагентов при обновлении списка на экране.
211
183
.. i18n: .. index::
212
184
.. i18n: pair: data; CSV structured
219
191
.. i18n: ----------------------------------------------
222
The CSV format for complex database structures
223
----------------------------------------------
194
Формат файла CSV для структур сложных баз данных
195
--------------------------------------------------
225
197
.. i18n: When you import data you have to overcome the problem of representing a database structure in \
226
.. i18n: ``.csv``\ flat files. To do this, two solutions are possible in Open ERP:
198
.. i18n: ``.csv``\ flat files. To do this, two solutions are possible in OpenERP:
229
When you import data you have to overcome the problem of representing a database structure in \
230
``.csv``\ flat files. To do this, two solutions are possible in Open ERP:
201
Когда вы импортируете данные, вам необходимо решить проблему представления структуры базы данных в плоских файлах ``.csv``. Для этого в OpenERP возможны два решения:
232
203
.. i18n: * importing a CSV file that's been structured in a particular way to enable you to load several
233
204
.. i18n: different database tables from a single file (such as partners and partner contacts in one CSV
237
208
.. i18n: links between the tables.
240
* importing a CSV file that's been structured in a particular way to enable you to load several
241
different database tables from a single file (such as partners and partner contacts in one CSV
242
file, as you have just done above),
211
* импорт файла CSV, который был структурирован определенным путем, чтобы дать вам возможность загружать несколько различных таблиц базы данных из одного файла (такого, как контрагенты и адреса контрагентов в одном файле CSV, как вы только что проделали выше),
244
* importing several CSV files, each corresponding to a specific database table, that have explicit
245
links between the tables.
213
* импорт нескольких файлов CSV, каждый из которых соответствует конкретной таблице базы данных, с заданными явными ссылками между таблицами.
247
215
.. i18n: .. note:: Server-side importing
253
221
.. i18n: server the column heading names must match the internal names of the fields.
256
.. note:: Server-side importing
224
.. note:: Импорт на стороне сервера
258
You can also import CSV data in through the server interface. The file format is the same, but
259
column headings differ slightly. When importing through the user interface it checks that the column
260
heading names match the names seen in the forms on the user interface itself.
261
In contrast, when importing through the
262
server the column heading names must match the internal names of the fields.
226
Вы можете также импортировать данные CSV при помощи интерфейса сервера. Формат файла остается таким же, но названия столбов немного отличаются. При импорте через пользовательский интерфейс он проверяет, что названия столбцов соответствуют названиям, показанным в формах самого пользовательского интерфейса. При импорте через сервер, названия столбцов должны соответствовать внутренним названиям полей.
264
228
.. i18n: Start by building the header of the CSV file. Open the import tool on the object that you're
265
.. i18n: interested in and select the fields that you want to import into your Open ERP database. You must
229
.. i18n: interested in and select the fields that you want to import into your OpenERP database. You must
266
230
.. i18n: include every field that's colored in blue because those fields are required (unless you know that they
267
231
.. i18n: get filled by default with an appropriate value), and also any other field that's important to you.
270
Start by building the header of the CSV file. Open the import tool on the object that you're
271
interested in and select the fields that you want to import into your Open ERP database. You must
272
include every field that's colored in blue because those fields are required (unless you know that they
273
get filled by default with an appropriate value), and also any other field that's important to you.
234
Начните с построения заголовка файла CSV. Откройте инструмент импорта интересующего вас объекта и выберите поля, которые вы хотите импортировать в вашу базу данных OpenERP. вы должны включить каждое поле, которое окрашено в синий цвет, потому что эти поля являются обязательными (если только вы не знаете, что они будут заполнены соответствующим значением по умолчанию), а также все поля, которые для вас важны.
275
236
.. i18n: .. figure:: images/csv_column_select.png
276
237
.. i18n: :scale: 75
286
*Selecting fields to import using a CSV file*
247
*Выбор полей для импорта с использованием файла CSV*
288
249
.. i18n: Use the field names as the column names in the first line of your CSV file, adding one field per
289
250
.. i18n: column. If your CSV file has these names in the first line then when you import your CSV file,
290
.. i18n: Open ERP will automatically match the column name to the field name of the table. When you've
251
.. i18n: OpenERP will automatically match the column name to the field name of the table. When you've
291
252
.. i18n: created your CSV file you'll do that by clicking the :guilabel:`Nothing` button to clear the
292
253
.. i18n: :guilabel:`Fields to Import`, then select your CSV file by browsing for a :guilabel:`File to
293
254
.. i18n: import`, and then clicking the :guilabel:`Auto Detect` button.
296
Use the field names as the column names in the first line of your CSV file, adding one field per
297
column. If your CSV file has these names in the first line then when you import your CSV file,
298
Open ERP will automatically match the column name to the field name of the table. When you've
299
created your CSV file you'll do that by clicking the :guilabel:`Nothing` button to clear the
300
:guilabel:`Fields to Import`, then select your CSV file by browsing for a :guilabel:`File to
301
import`, and then clicking the :guilabel:`Auto Detect` button.
257
Используйте названия полей в качестве названий столбцов в первой строке вашего файла CSV, добавляя одно поле на столбец. Если в вашем файле CSV в первой строке будут присутствовать эти названия, то при импорте файла CSV OpenERP будет автоматически устанавливать соответствие названия столбца с названием поля в таблице. Когда вы создадите ваш файл CSV, проделайте, нажав кнопку :guilabel:`[Ничего] (Nothing)`, чтобы очистить :guilabel:`Поля для импорта (Fields to Import)`, затем выберите ваш файл CSV в окне :guilabel:`Файл для импорта (File to import)`, и нажмите кнопку :guilabel:`[Автоопределение] Auto Detect`.
303
259
.. i18n: To import CSV data that matches your database structure, you should distinguish between the following types
304
.. i18n: of field in the Open ERP interface: *many-to-many* fields (between multiple sources and
260
.. i18n: of field in the OpenERP interface: *many-to-many* fields (between multiple sources and
305
261
.. i18n: destinations), *many-to-one* fields (from multiple sources to a single destination), and *one-to-
306
262
.. i18n: many* fields (from a single origin to multiple destinations).
309
To import CSV data that matches your database structure, you should distinguish between the following types
310
of field in the Open ERP interface: *many-to-many* fields (between multiple sources and
311
destinations), *many-to-one* fields (from multiple sources to a single destination), and *one-to-
312
many* fields (from a single origin to multiple destinations).
265
Для импорта данных CSV, которые соответствуют структуре вашей базы данных, вам надо делать различие между следующими типами полей в интерфейсе OpenERP: поля *многие-ко-многим (many-to-many)* (между различными источниками и назначениями), поля *многие-к-одному (many-to-one)* (от многих источников к одному назначению), и поля *один-ко-многим (one-to-many)* (от одного источника ко многим назначениям).
314
267
.. i18n: .. note:: Foreground table
325
278
.. i18n: :guilabel:`child_ids` Partner contacts field in the Partner form.
328
.. note:: Foreground table
330
Each of these types is described in relation to a foreground table –
331
the table whose entry form you're viewing and whose entries would be updated by a simple CSV file.
333
Just because one of these relation fields appears on the foreground table, does not mean that there
334
is an inverse field on the related table – but there may be.
336
So there is *no* one-to-many field in the User form to reflect the many-to-one :guilabel:`user_id` Salesman field in
338
but there *is* a many-to-one :guilabel:`partner_id` Partner field in the Partner contact form to reflect the one-to-many
339
:guilabel:`child_ids` Partner contacts field in the Partner form.
281
.. note:: Активная таблица
283
Каждый из этих типов описан в отношении к активной таблице -- т.е. той таблице, форму ввода которой вы и записи которой будут изменены простым файлом CSV.
285
То, что одно из этих полей с отношением присутствует в активной таблице, не означает, что существует обратное поле в таблице, к которой построено отношение -- но такое поле может и существовать.
287
Так, в форме Пользователь (User) *не существует* поля типа один-ко-многим (one-to-many) для отображения поля :guilabel:`user_id` Продавец (Salesman) типа многие-к-одному (many-to-one) :guilabel:`user_id` из формы Контрагента (Partner), но *существует* поле Контрагент(Partner) типа много-к-одному (many-to-one) :guilabel:`partner_id` на форме Контакт контрагента (Partner contact) для отображения поля Контакты контрагента (Partner contacts) из формы Контрагент (Partner) для отображения поля типа один-ко-многим (one-to-many) :guilabel:`child_ids`.
341
289
.. i18n: Have a look at the screenshots below to see the differences.
344
Have a look at the screenshots below to see the differences.
292
Чтобы увидеть различия, посмотрите на иллюстрации ниже, показывающие экраны.
346
294
.. i18n: .. figure:: images/csv_many2one.png
347
295
.. i18n: :scale: 75
398
346
.. i18n: ^^^^^^^^^^^^^^^^^^
350
^^^^^^^^^^^^^^^^^^^^^
404
352
.. i18n: Many-to-one fields represent a relationship between the foreground table and another table in the
405
.. i18n: database where the foreground table has a single entry for the other table. Open ERP tries to link
353
.. i18n: database where the foreground table has a single entry for the other table. OpenERP tries to link
406
354
.. i18n: the new record in the foreground table with the field in the other table by matching the field values.
409
Many-to-one fields represent a relationship between the foreground table and another table in the
410
database where the foreground table has a single entry for the other table. Open ERP tries to link
411
the new record in the foreground table with the field in the other table by matching the field values.
357
Поля типа многие-к-одному (many-to-one) представляют отношение между активной таблицей и другой таблицей в базе данных, где активная таблица имеет одну запись для для другой таблицы. OpenERP пытается связать новую запись в активной таблице с полем в другой таблице путем сравнения значений поля.
413
359
.. i18n: .. tip:: Field identifiers
422
368
.. i18n: instead of the product name).
423
369
.. i18n: You then don't need any complex conversion to create links between the two tables.
425
.. i18n: This considerably simplifies the importation of another database into Open ERP.
371
.. i18n: This considerably simplifies the importation of another database into OpenERP.
426
372
.. i18n: You just create a linking ``id`` column for each table that you're importing
427
373
.. i18n: that contains the identifier used in the first table.
430
.. tip:: Field identifiers
432
If you're working on the server side you can use identifiers rather than the names of resources
433
to link tables. To do this you import the
434
first file (for example, Products) with a column named :guilabel:`id` in your CSV file that contains a
435
unique identifier for each product. This could be an incrementing number.
437
When you import other files which link to the first table, you can use the identifier in preference
438
to the names (so, for example, when you're saving inventory you can use \ ``product:id``\
439
instead of the product name).
440
You then don't need any complex conversion to create links between the two tables.
376
.. tip:: Идентификаторы полей
378
Если вы работаете на стороне сервера, вам надо использовать идентификаторы, а не названия ресурсов для связи таблиц. Чтобы сделать это, импортируйте первый файл (например, Продукты (Products)) с колонкой, которая называется :guilabel:`id` в вашем файле CSV, содержащем уникальный идентификатор для каждого продукта. Это может быть увеличивающееся число.
380
Когда вы импортируете другие файлы, которые связаны с первой таблицей, вам будет предпочтительнее использовать идентификатор, а не название (так, например, когда вы сохраняете результаты инвентаризации, вы можете использовать ``product:id``, а не название продукта). После этого вам не требуется никаких сложных преобразований для создания связей между таблицами.
442
This considerably simplifies the importation of another database into Open ERP.
443
You just create a linking ``id`` column for each table that you're importing
444
that contains the identifier used in the first table.
382
Это намного облегчает импорт другой базы данных в OpenERP. Вы сначала для каждой импортируемой вами таблицы создаете связующий столбец ``id`` для каждой импортируемой вами таблицы, который содержит идентификатор, используемый в первой таблице.
446
384
.. i18n: Many-to-many fields
447
385
.. i18n: ^^^^^^^^^^^^^^^^^^^
388
Поля многие-ко-многим
389
^^^^^^^^^^^^^^^^^^^^^^^
453
391
.. i18n: Many-to-many fields are handled just like many-to-one fields in trying to recreate the relationship
454
392
.. i18n: between tables: either by searching for names or by using identifiers.
457
Many-to-many fields are handled just like many-to-one fields in trying to recreate the relationship
458
between tables: either by searching for names or by using identifiers.
395
Поля типа многие-ко-многим обрабатываются также, как и поля типа многие-к-одному в попытке воссоздать отношения между таблицами: либо поиском по имени, либо с использованием идентификаторов.
460
397
.. i18n: There are several possible values in a single many-to-many field. Therefore a partner can be given
461
398
.. i18n: several associated categories. You must separate the different values with a comma.
464
There are several possible values in a single many-to-many field. Therefore a partner can be given
465
several associated categories. You must separate the different values with a comma.
401
В одном поле типа многие-ко-многим может содержаться несколько значений. Следовательно, контрагент может обладать несколькими ассоциированными категориями. Вы должны разделять различные значения запятыми.
467
403
.. i18n: One-to-many fields
468
404
.. i18n: ^^^^^^^^^^^^^^^^^^
408
^^^^^^^^^^^^^^^^^^^^^
474
410
.. i18n: One-to-many fields are a bit different. Take as an example the :guilabel:`Partner Contacts` field in
475
411
.. i18n: the Partner form, which contains all of the linked contacts.
478
One-to-many fields are a bit different. Take as an example the :guilabel:`Partner Contacts` field in
479
the Partner form, which contains all of the linked contacts.
414
Поля типа один-ко-многим немного другие. Рассмотрим в качестве примера поле :guilabel:`Контакты контрагента (Partner Contacts)` на форме партнера, которое содержит все связанные контакты.
481
416
.. i18n: To import such a field you don't have to link to an existing entry in another table, but can instead
482
417
.. i18n: create and link to several partner contacts using the same file. You can then specify several values
485
420
.. i18n: many/field_linked-object``\ . The partner data you imported earlier took that form.
488
To import such a field you don't have to link to an existing entry in another table, but can instead
489
create and link to several partner contacts using the same file. You can then specify several values
490
for different fields linked to that object by the one-to-many field. Each field must be put in a
491
column of the table, and the title of that column must be expressed in the form \ ``field_one-to-
492
many/field_linked-object``\ . The partner data you imported earlier took that form.
423
Чтобы импортировать такое поле, вам не нужно связывать его с существующей записью в другой таблице, но вы можете создать и связать несколько контактов партнера, используя тот самый же файл. Вы можете затем указать несколько значений для различных полей, связанных с этим объектом полем типа один-ко-многим. Каждое поле должно быть помещено в столбец таблицы, и заголовок этого столбца должен быть выражен в виде ``field_one-to-many/field_linked-object``. Данные партнера, которые вы импортировали ранее, были оформлены именно таким образом.
494
425
.. i18n: .. note:: Symmetry in relation fields
504
435
.. i18n: one form).
507
.. note:: Symmetry in relation fields
509
Depending on the structure of your data it can be easier to use the one-to-many form or the many-
510
to-one form in relating two tables, so long as the relevant fields exist on both ends of the relationship.
512
For example, you can:
514
* import one partner with different contact in a single file (one-to-many),
516
* import the partners first, and then contacts with the field linking to the partner in a many-to-
438
.. note:: Симметрия в полях отношений
440
В зависимости от структуры ваших данных использовать форму один-ко-многим или многие-к-одному в отношениях двух таблиц может быть легче, до тех пор, пока поля отношений существуют на обеих сторонах отношений.
444
* импортировать одного контрагента с различными контактами в одном файле (один-ко-многим),
446
* вначале импортировать контрагентов, а затем контакты с полем, связанным с контрагентом в формате многие-к-одному).
519
448
.. i18n: .. index::
520
449
.. i18n: single: data; import example
537
466
.. i18n: use *many-to-many* relations). You must create new categories in a separate step.
540
To illustrate data importing, you can see another example below. First import partner
541
categories, and then import some partners and their contacts along with links to the categories
542
just created. Although you can create new contacts at the same time as creating partners (because
543
you can do this for *one-to-many* relations), you can't create new categories this way (because they
544
use *many-to-many* relations). You must create new categories in a separate step.
469
Чтобы проиллюстрировать импорт данных, рассмотрим ниже еще один пример. Вначале импортируем категории контрагентов, а затем импортируем нескольких контрагентов и их контакты вместе со ссылками на только что созданные категории категории. Хотя вы можете создавать новые контакты одновременно с созданием контрагентов, (потому что вы можете делать это для отношений *один-ко-многим*), вы не можете создать этим путем новые категории (потому что они используют отношения *многие-ко-многим*). Вы должны создать новые категории в отдельном шаге.
546
471
.. i18n: Partner categories
547
472
.. i18n: ^^^^^^^^^^^^^^^^^^
548
473
.. i18n: Start by creating partner categories in a CSV file:
553
Start by creating partner categories in a CSV file:
476
Категории контрагентов
477
^^^^^^^^^^^^^^^^^^^^^^^^
478
Начните путем создания категорий контрагентов в файле CSV:
555
480
.. i18n: #. Create the following table in your spreadsheet program:
558
#. Create the following table in your spreadsheet program:
483
#. Создайте следующую таблицу в вашем табличном калькуляторе:
560
485
.. i18n: .. csv-table:: Partner categories file
561
486
.. i18n: :header: "","Column A","Column B"
576
501
.. i18n: blank then the category sits at the top level.
579
.. csv-table:: Partner categories file
580
:header: "","Column A","Column B"
504
.. csv-table:: Файл категорий контрагентов
505
:header: "","Столбец A (Column A)","Столбец B (Column B)"
583
"Line 1","Category Name","Parent Category"
584
"Line 2","Quality",""
585
"Line 3","Gold","Quality"
586
"Line 4","Silver","Quality"
587
"Line 5","Bronze","Quality"
589
On the first line, :guilabel:`Category Name` and :guilabel:`Parent Category` are
590
the column titles that correspond to field names in the :guilabel:`Partner
593
:guilabel:`Column A` is for the different partner categories and :guilabel:`Column
594
B` indicates if that category has a parent category. If :guilabel:`Column B` is
595
blank then the category sits at the top level.
508
"Строка 1 (Line 1)","Название категории (Category Name)","Родительская категория (Parent Category)"
509
"Строка 2 (Line 2)","Качество (Quality)",""
510
"Строка 3 (Line 3)","Золотой (Gold)","Качество (Quality)"
511
"Строка 4 (Line 4)","Серебряный (Silver)","Качество (Quality)"
512
"Строка 5 (Line 5)","Бронзовый (Bronze)","Качество (Quality)"
514
В первой строке, :guilabel:`Название категории (Category Name)` и :guilabel:`Родительская категория (Parent Category)` -- это заголовки столбцов, которые соответствуют именам полей в форме :guilabel:`Категории контрагентов (Partner category)`.
516
:guilabel:`Столбец A (Column A)` содержит различные категории контрагентов, а :guilabel:`Столбец B (Column B)` показывает, имеется ли родительская категория для данной категории. Если :guilabel:`Столбец B (Column B)` пуст, то категория располагается на верхнем уровне.
597
518
.. i18n: #. Save spreadsheet file in CSV format – separated by commas – and name the file
598
519
.. i18n: \ ``categories.csv``\.
600
.. i18n: #. In Open ERP, select :menuselection:`Partners --> Configuration --> Categories --> Edit
521
.. i18n: #. In OpenERP, select :menuselection:`Partners --> Configuration --> Categories --> Edit
601
522
.. i18n: Categories`.
603
524
.. i18n: #. Click :guilabel:`Import` (to the bottom left of the list) to bring up the :guilabel:`Import Data` dialog
615
536
.. i18n: including the new \ ``Quality``\ branch that you loaded.
618
#. Save spreadsheet file in CSV format – separated by commas – and name the file
619
\ ``categories.csv``\.
621
#. In Open ERP, select :menuselection:`Partners --> Configuration --> Categories --> Edit
624
#. Click :guilabel:`Import` (to the bottom left of the list) to bring up the :guilabel:`Import Data` dialog
625
box, in which you'll find the ist of fields that can be imported.
627
#. Click :guilabel:`Browse...` on the :guilabel:`File to import` field and select the CSV file you
628
just created, \ ``categories.csv``\ Then click :guilabel:`Auto Detect` to atch the column names
629
in the CSV file with the field names available in:guilabel:`Partner Categories`.
631
#. Click :guilabel:`Import` at the bottom-right of the dialog box to load your data. You should get
632
the message \ ``4 objects imported``\ in a new dialog box. Close both this and the
633
:guilabel:`Import Data` dialog box to return to the original page.
635
#. Click :menuselection:`Partners --> Partners by category` to view the tree of categories,
636
including the new \ ``Quality``\ branch that you loaded.
539
#. Сохраните таблицу в файл CSV -- разделенный запятыми -- и назовите файл ``categories.csv``.
541
#. В OpenERP выберите :menuselection:`[Контрагенты --> Настройки --> Категории --> Изменить категории] (Partners --> Configuration --> Categories --> Edit Categories)`.
543
#. Нажмите :guilabel:`[Импорт] Import` (внизу слева от списка), чтоыб вызвать диалоговое окно :guilabel:`[Импорт данных] Import Data`, в котором вы увидите список полей для импорта.
545
#. Нажмите :guilabel:`[Просмотр] Browse...` в поле :guilabel:`[Файл для импорта] File to import` и выберите файл CSV, который вы только что создали, ``categories.csv``. Затем нажмите :guilabel:`[Автоопределение] Auto Detect` для поиска соответствия названий столбцов в файле CSV с именами полей, доступных в :guilabel:`Категории контрагентов (Partner Categories)`.
547
#. Нажмите :guilabel:`[Импорт] (Import)` справа внизу диалогового окна для загрузки ваших данных. Вы должны получить сообщение ``4 объекта импортировано (4 objects imported)`` в носом диалоговом окне. Закройте оба окна -- это и диалоговое окно :guilabel:`Импорт данных (Import Data)`, чтобы вернуться к исходной странице.
549
#. Нажмите :menuselection:`[Контрагенты --> Контрагенты по категориям] (Partners --> Partners by category)`, чтобы увидеть древо категорий, включая новую ветку ``Качество (Quality)``, которую вы загрузили.
638
551
.. i18n: New partners
639
552
.. i18n: ^^^^^^^^^^^^
645
558
.. i18n: Here's how to create new partners with more than one contact, as you did before, and how to link them to these new categories:
648
Here's how to create new partners with more than one contact, as you did before, and how to link them to these new categories:
561
Теперь о том, как создать новых контрагентов с более, чем одним контактом, как вы делали ранее, и как связать их с этими новыми категориями:
650
563
.. i18n: #. Enter the table below into your spreadsheet program.
653
#. Enter the table below into your spreadsheet program.
566
#. Создайте в вашем табличном калькуляторе следующую таблицу.
655
568
.. i18n: .. csv-table:: Partner data file - partners.csv
656
569
.. i18n: :header: "","Column A","Column B","Column C","Column D"
662
575
.. i18n: "Line 4","Tiny sprl","","Fabien Pinckaers","Administrator"
665
.. csv-table:: Partner data file - partners.csv
666
:header: "","Column A","Column B","Column C","Column D"
578
.. csv-table:: Файл данных контрагентов - partners.csv
579
:header: "","Столбец A (Column A)","Столбец B (Column B)","Столбец C (Column C)","Столбец D (Column D)"
667
580
:widths: 5,10,10,10,10
669
"Line 1","Name","Categories","Contacts/Contact Name","Dedicated Salesman"
670
"Line 2","Black Advertising","Silver,Gold","George Black","Administrator"
671
"Line 3","","","Jean Green",""
672
"Line 4","Tiny sprl","","Fabien Pinckaers","Administrator"
582
"Строка 1 (Line 1)","Название (Name)","Категории (Categories)","Контакты/Имя контакта (Contacts/Contact Name)","Выделенный продавец (Dedicated Salesman)"
583
"Строка 2 (Line 2)","Black Advertising","Silver,Gold","George Black","Administrator"
584
"Строка 3 (Line 3)","","","Jean Green",""
585
"Строка 4 (Line 4)","Tiny sprl","","Fabien Pinckaers","Administrator"
674
587
.. i18n: #. The second line corresponds to the creation of a new partner, with two existing categories, that
675
588
.. i18n: has two contacts and is linked to a salesman.
684
597
.. i18n: (``Silver`` and ``Gold``).
687
#. The second line corresponds to the creation of a new partner, with two existing categories, that
688
has two contacts and is linked to a salesman.
690
#. Save the file using the name \ ``partners.csv``\
692
#. In OpenERP, select :menuselection:`Partners --> Partners` then import the file that you've just
693
saved. You'll get a message confirming that you've imported and saved the data.
695
#. Verify that you've imported the data. A new partner should have appeared (``NoirAdvertising``),
696
with a salesman (``Administrator``), two contacts (``George Black`` and ``Jean Green``) and two categories
697
(``Silver`` and ``Gold``).
600
#. Вторая строка соответствует созданию нового контрагента, с двумя существующими категориями, у которого есть два контакта и который связан с продавцом.
602
#. Сохраните файл под именем ``partners.csv``.
604
#. В OpenERP выберите :menuselection:`[Контрагенты --> Контрагенты] (Partners --> Partners)`, затем импортируйте только что сохраненный вами файл. Будет выведено сообщение, подтверждающее что ваши данные импортированы и сохранены.
606
#. Убедитесь, что данные импортированы успешно. Должен появиться новый контрагент (``NoirAdvertising``), с продавцом (``Administrator``), двумя контактами (``George Black`` и ``Jean Green``) и двумя категориями (``Silver`` and ``Gold``).
699
608
.. i18n: .. index::
700
609
.. i18n: single: data, export in other forms
707
616
single: data, export in other forms
709
Exporting data in other forms
710
-----------------------------
618
Экспорт данных в других видах
619
-------------------------------
712
.. i18n: Open ERP's generic export mechanism lets you easily export any of your data to any location on your
621
.. i18n: OpenERP's generic export mechanism lets you easily export any of your data to any location on your
713
622
.. i18n: system. You're not restricted to what you can export, although you can restrict who can export that
714
623
.. i18n: data using the rights management facilities discussed above.
717
Open ERP's generic export mechanism lets you easily export any of your data to any location on your
718
system. You're not restricted to what you can export, although you can restrict who can export that
719
data using the rights management facilities discussed above.
626
Общий механизм экспорта OpenERP позволяет вам легко экспортировать любые ваши данные в любое место вашей системы. Ограничения, что вы хотите экспортировать, не существует, однако вы можете установить ограничение, кто может экспортировать определенные данные, используя механизмы управления правами, описанные выше.
721
628
.. i18n: You can use this to export your data into spreadsheets or into other systems such as specialist
722
629
.. i18n: accounts packages. The export format is usually in the CSV format but you can also connect directly
723
630
.. i18n: to Microsoft Excel using Microsoft's COM mechanism.
726
You can use this to export your data into spreadsheets or into other systems such as specialist
727
accounts packages. The export format is usually in the CSV format but you can also connect directly
728
to Microsoft Excel using Microsoft's COM mechanism.
633
Вы использовать механизм для экспорта ваших данных в табличные файлы или иные системы, такие как специализированные бухгалтерские пакеты. Обычно формат экспорта -- это формат CSV, но вы можете также подсоединяться непосредственно к Microsoft Excel при помощи механизма COM Microsoft.
730
635
.. i18n: .. tip:: Access to the database
732
.. i18n: Developers can also use other techniques to automatically access the Open ERP database. The two
637
.. i18n: Developers can also use other techniques to automatically access the OpenERP database. The two
733
638
.. i18n: most useful are:
735
640
.. i18n: * using the XML-RPC web service,
737
642
.. i18n: * accessing the PostgreSQL database directly.
740
.. tip:: Access to the database
742
Developers can also use other techniques to automatically access the Open ERP database. The two
745
* using the XML-RPC web service,
747
* accessing the PostgreSQL database directly.
645
.. tip:: Доступ к базе данных
647
Разработчики могут также использовать другие методы для автоматического доступа к базе данных OpenERP. Два наиболее полезных:
649
* использование веб-сервиса XML-RPC,
651
* прямой доступ к базе данных PostgreSQL.
749
653
.. i18n: .. tip:: Module Recorder
751
.. i18n: If you want to enter data into Open ERP manually, you should use the Module Recorder, described in
655
.. i18n: If you want to enter data into OpenERP manually, you should use the Module Recorder, described in
752
656
.. i18n: the first section of this chapter.
754
658
.. i18n: By doing that you'll generate a module that can easily be reused in different databases.
757
661
.. i18n: with all of the entries and modifications you made for this system.
760
.. tip:: Module Recorder
762
If you want to enter data into Open ERP manually, you should use the Module Recorder, described in
763
the first section of this chapter.
765
By doing that you'll generate a module that can easily be reused in different databases.
766
Then if there are problems with a database you'll be able to reinstall the data module you
768
with all of the entries and modifications you made for this system.
664
.. tip:: Записывающий модуль
666
Если вы хотите вводить данные в OpenERP вручную, вам лучше использовать записывающий модуль, описанный в первом разделе данной главы.
668
Действуя таким образом, вы создадите модуль, который можно будет легко использовать в различных базах данных. Тогда при проблемах с базой данных вы сможете заново установить модуль данных, который вы создали, со всеми внесенными в систему проводками и изменениями.
770
670
.. i18n: .. Copyright © Open Object Press. All rights reserved.