From 61986b34795603d5bae6f43f4aa369625d5f8f3a Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Thu, 25 Oct 2012 19:11:21 +0530 Subject: [IMP]View improvement. bzr revid: vba@tinyerp.com-20121025134121-jn73k1lxta13idcg --- addons/base_import/static/src/xml/import.xml | 50 +++++++++++++++++++--------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 4f721032d1d..eac6362708a 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -1,21 +1,39 @@ +
+ + + + + + + + + + + +
+

+ + Upload your file + +

+
+ + + or + Cancel + + + +
-
- - - or - Cancel -
- - -

Upload your file

Select the .CSV @@ -25,7 +43,7 @@ -

@@ -80,7 +98,9 @@
+
+ Date: Mon, 29 Oct 2012 10:20:26 +0530 Subject: [IMP]put a tooltip on the refresh button. bzr revid: vba@tinyerp.com-20121029045026-lqvpzryidxjd9z3b --- addons/base_import/static/src/xml/import.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 4f721032d1d..935192c52c9 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -25,7 +25,7 @@ -
-- cgit v1.2.3 From f22387e8c09fa055f6c0e1b84d94a6dac201ff9e Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 29 Oct 2012 14:31:41 +0530 Subject: [IMP]Improve view. bzr revid: vba@tinyerp.com-20121029090141-eapggkys3ltbyquh --- addons/base_import/static/src/xml/import.xml | 38 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 935192c52c9..497d1c2c6c9 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -2,20 +2,28 @@
-
- - - or - Cancel -
- - -

Upload your file

+
+
+

+ + Upload your file + +

+ + + + + or + Cancel +
+
+ +

Select the .CSV @@ -44,7 +52,7 @@

-
+

Map your data to OpenERP

-- cgit v1.2.3 From 92133099cc4ac3cbe6a9a20d59ad8251d9e7088e Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 29 Oct 2012 14:57:50 +0530 Subject: [IMP]View Improvement bzr revid: vba@tinyerp.com-20121029092750-tc6mm0xj1eiiwrqh --- addons/base_import/static/src/xml/import.xml | 44 ++++++++++------------------ 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 96b9e8dda7c..632b07801a4 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -1,39 +1,28 @@ -
- - - - - - - - - - - -
+ + +
+

Upload your file

-
- - - or - Cancel - + t-att-value="widget.session.session_id"/> -
- - + + + or + Cancel +
+
+

Select the .CSV @@ -98,7 +87,6 @@

-
-- cgit v1.2.3 From b37dc17a3c1ad03d4f9c611d24749fcdc1456d11 Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 29 Oct 2012 18:47:46 +0530 Subject: [IMP]Import functionality in kanban views. and add a Frequently Asked Questions. bzr revid: vba@tinyerp.com-20121029131746-ndc4qmd76xpne9ww --- addons/base_import/static/src/xml/import.xml | 109 ++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 3 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 632b07801a4..3c4c3e57b36 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -72,19 +72,111 @@

In order to re-create relationships between different records, you should use the unique - identifier from the original application and + identifier from the original application
and map it to the ID column in OpenERP. When you import an other record that links to the first one, use XXX/ID - to the original unique identifier.

+ to the
original unique identifier.

The ID will also be used to update the original import if you need to re-import modified data - later, it's thus good practice to specify it + later, it's thus good practice to
specify it whenever possible

+ +
+
+ What can I do when the Import preview table isn't displayed correctly?
+
+

By default the Import preview is set on commas as + field separators and quotation marks as text + delimiters.
If your csv file does not have these + settings, you can modify the File Format Options + (displayed under the Browse CSV file bar after you + select your file).

Note that if your CSV file + has a tabulation as separator, OpenERP will not + detect the separations. You will need to change the +
file format options in your spreadsheet application. + See the following question.

+
+
+ +
+
+ How can I change the CSV file format options when saving in my spreadsheet application?
+
+

If you edit and save CSV files in speadsheet applications, your computer's regional settings will be applied for the separator and delimiter. We suggest you use OpenOffice or LibreOffice Calc as they will allow you to modify all three options (in 'Save As' dialog box > Check the box 'Edit filter settings' > Save).

Microsoft Excel will allow you to modify only the encoding when saving (in 'Save As' dialog box > click 'Tools' dropdown list > Encoding tab).

+
+
+ +
+
+ What's the difference between Database ID and External ID?
+
+

Some fields define a relationship with another object. For example, the country of a contact is a link to a record of the 'Country' object. When you want to import such fields, OpenERP will have to recreate links between the different records. To help you import such fields, OpenERP provides 3 mechanisms. You must use one and only one mechanism per field you want to import.

+

For example, to reference the country of a contact, OpenERP proposes you 3 different fields to import:

    +
  • Country: the name or code of the country
  • +
  • Country/Database ID: the unique OpenERP ID for a record, defined by the ID postgresql column
  • +
  • Country/External ID: the ID of this record referenced in another application (or the .XML file that imported it)
  • +

+

For the country Belgium, you can use one of these 3 ways to import:

    +
  • Country: Belgium
  • +
  • Country/Database ID: 21
  • +
  • Country/External ID: base.be
  • +

+

According to your need, you should use one of these 3 ways to reference records in relations. Here is when you should use one or the other, according to your need:

    +
  • Use Country: This is the easiest way when your data come from CSV files that have been created manually.
  • +
  • Use Country/Database ID: You should rarely use this notation. It's mostly used by developers as it's main advantage is to never have conflicts (you may have several records with the same name, but they always have a unique Database ID)
  • +
  • Use Country/External ID: Use External ID when you import data from a third party application.
  • +

+
+
+ +
+
+ What can I do if I have multiple matches for a field?
+
+

If for example you have two product categories with the child name "Sellable" (ie. "Misc. Products/Sellable" & "Other Products/Sellable"), your validation is halted. You can decide to modify one of the duplicates values.


However if you do not wish to change the duplicates' values, we recommend you use make use of the external ID for this field 'Category'.

First you need to change the field in your CSV file to 'Field / External ID' (ie. 'Category / External ID').
Then you need to replace all the records (ie. categories) with their corresponding External IDs. You get these IDs by selecting all the records in their list view and clicking the export feature (in More). You receive a CSV file where the first column displays each record's External ID.

Then you can concatenate the cells that allow you to make each record unique (ie. Category name and Parent name) and finally make use of a VLOOKUP function to replace the values set in the original CSV file with their corresponding external IDs.

+
+
+ +
+
+ How can I import a many2many relationship field (e.g. a customer that has multiple tags)?
+
+

The tags should be separated by a comma without any spacing. For example, if you want you customer to be lined to both tags 'Manufacturer' and 'Retailer' then you will encode it as follow "Manufacturer,Retailer" in the same column of your CSV file.

+
+
+ +
+
+ Can I import several times the same record?
+
+

If you import a file that contains one of the column "External ID" or "Database ID", records that have already been imported will be modified instead of being created. This is very usefull as it allows you to import several times the same CSV file while having made some changes in between two imports. OpenERP will take care of creating or modifying each record depending if it's new or not.

This feature allows you to use the Import/Export tool of OpenERP to modify a batch of records in your favorite spreadsheet application.

+
+
+ +
+
+ What happens if I do not provide a value for a specific field?
+
+

If you do not set all fields in your CSV file, OpenERP will assign the default value for every non defined fields. But if you +set fields with empty values in your CSV file, OpenERP will set the EMPTY value in the field, instead of assigning the default value.

+
+
+ +
+
+ How to export/import different tables from an SQL application to OpenERP?
+
+

If you need to import data from different tables, you will have to recreate relations between records belonging to different tables. (e.g. if you import companies and persons, you will have to recreate the link between each person and the company they work for).

+
+
+ + +
@@ -146,4 +238,15 @@ Import + + + + or +
+ Import +
+
+
+
+
-- cgit v1.2.3 From a45cdc652b2c46ff7e83a106e6c81274d5037abc Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Thu, 1 Nov 2012 16:40:04 +0530 Subject: [IMP]Improve Code and add a csv file. bzr revid: vba@tinyerp.com-20121101111004-no023s4rzpze3i50 --- addons/base_import/static/src/xml/import.xml | 236 ++++++++++++++++++++++----- 1 file changed, 199 insertions(+), 37 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 3c4c3e57b36..ea9da98f2eb 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -66,116 +66,278 @@

Frequently Asked Questions

+
Need to import data from an other application?

In order to re-create relationships between different records, you should use the unique - identifier from the original application
and + identifier from the original application and map it to the ID column in OpenERP. When you import an other record that links to the first one, use XXX/ID - to the
original unique identifier.

+ to the original unique identifier.

The ID will also be used to update the original import if you need to re-import modified data - later, it's thus good practice to
specify it + later, it's thus good practice to specify it whenever possible

- What can I do when the Import preview table isn't displayed correctly?
+ What can I do when the Import preview table isn't + displayed correctly?

By default the Import preview is set on commas as field separators and quotation marks as text - delimiters.
If your csv file does not have these + delimiters. If your csv file does not have these settings, you can modify the File Format Options (displayed under the Browse CSV file bar after you select your file).

Note that if your CSV file has a tabulation as separator, OpenERP will not detect the separations. You will need to change the -
file format options in your spreadsheet application. + file format options in your spreadsheet application. See the following question.

- How can I change the CSV file format options when saving in my spreadsheet application?
+ How can I change the CSV file format options when + saving in my spreadsheet application?
-

If you edit and save CSV files in speadsheet applications, your computer's regional settings will be applied for the separator and delimiter. We suggest you use OpenOffice or LibreOffice Calc as they will allow you to modify all three options (in 'Save As' dialog box > Check the box 'Edit filter settings' > Save).

Microsoft Excel will allow you to modify only the encoding when saving (in 'Save As' dialog box > click 'Tools' dropdown list > Encoding tab).

+

If you edit and save CSV files in speadsheet + applications, your computer's regional settings will + be applied for the separator and delimiter. + We suggest you use OpenOffice or LibreOffice Calc + as they will allow you to modify all three options + (in 'Save As' dialog box > Check the box 'Edit filter + settings' > Save).

Microsoft Excel will allow + you to modify only the encoding when saving + (in 'Save As' dialog box > click 'Tools' dropdown + list > Encoding tab).

- What's the difference between Database ID and External ID?
+ What's the difference between Database ID and + External ID?
-

Some fields define a relationship with another object. For example, the country of a contact is a link to a record of the 'Country' object. When you want to import such fields, OpenERP will have to recreate links between the different records. To help you import such fields, OpenERP provides 3 mechanisms. You must use one and only one mechanism per field you want to import.

-

For example, to reference the country of a contact, OpenERP proposes you 3 different fields to import:

    -
  • Country: the name or code of the country
  • -
  • Country/Database ID: the unique OpenERP ID for a record, defined by the ID postgresql column
  • -
  • Country/External ID: the ID of this record referenced in another application (or the .XML file that imported it)
  • -

-

For the country Belgium, you can use one of these 3 ways to import:

    -
  • Country: Belgium
  • -
  • Country/Database ID: 21
  • -
  • Country/External ID: base.be
  • -

-

According to your need, you should use one of these 3 ways to reference records in relations. Here is when you should use one or the other, according to your need:

    -
  • Use Country: This is the easiest way when your data come from CSV files that have been created manually.
  • -
  • Use Country/Database ID: You should rarely use this notation. It's mostly used by developers as it's main advantage is to never have conflicts (you may have several records with the same name, but they always have a unique Database ID)
  • -
  • Use Country/External ID: Use External ID when you import data from a third party application.
  • -

+

Some fields define a relationship with another + object. For example, the country of a contact is a + link to a record of the 'Country' object. When you + want to import such fields, OpenERP will have to + recreate links between the different records. + To help you import such fields, OpenERP provides 3 + mechanisms. You must use one and only one mechanism + per field you want to import.

For example, to + reference the country of a contact, OpenERP proposes + you 3 different fields to import:

    +
  • Country: the name or code of the country
  • +
  • Country/Database ID: the unique OpenERP ID for a + record, defined by the ID postgresql column
  • +
  • Country/External ID: the ID of this record + referenced in another application (or the .XML file + that imported it)

For the country + Belgium, you can use one of these 3 ways to import: +

  • Country: Belgium
  • Country/Database + ID: 21
  • Country/External ID: base.be
  • +

According to your need, you should use + one of these 3 ways to reference records in relations. + Here is when you should use one or the other, + according to your need:

  • Use Country: This is + the easiest way when your data come from CSV files + that have been created manually.
  • Use + Country/Database ID: You should rarely use this + notation. It's mostly used by developers as it's main + advantage is to never have conflicts (you may have + several records with the same name, but they always + have a unique Database ID)
  • Use + Country/External ID: Use External ID when you import + data from a third party application.

+

When you use External IDs, you can import CSV files + with the "External ID" column to define the External + ID of each record you import. Then, you will be able + to make a reference to that record with columns like + "Field/External ID". The following two CSV files give + you an example for Products and their Categories.

+ CSV file for categories
+ CSV file for Products + +
- What can I do if I have multiple matches for a field?
+ What can I do if I have multiple matches for a field? +
-

If for example you have two product categories with the child name "Sellable" (ie. "Misc. Products/Sellable" & "Other Products/Sellable"), your validation is halted. You can decide to modify one of the duplicates values.


However if you do not wish to change the duplicates' values, we recommend you use make use of the external ID for this field 'Category'.

First you need to change the field in your CSV file to 'Field / External ID' (ie. 'Category / External ID').
Then you need to replace all the records (ie. categories) with their corresponding External IDs. You get these IDs by selecting all the records in their list view and clicking the export feature (in More). You receive a CSV file where the first column displays each record's External ID.

Then you can concatenate the cells that allow you to make each record unique (ie. Category name and Parent name) and finally make use of a VLOOKUP function to replace the values set in the original CSV file with their corresponding external IDs.

+

If for example you have two product categories + with the child name "Sellable" (ie. "Misc. + Products/Sellable" & "Other Products/Sellable"), + your validation is halted but you may still import + your data. However, we recommend you do not import the + data because they will all be linked to the first + 'Sellable' category found in the Product Category list + ("Misc. Products/Sellable"). We recommend you modify + one of the duplicates' values or your product category + hierarchy. + However if you do not wish to change your + configuration of product categories, we recommend you + use make use of the external ID for this field + 'Category'.

- How can I import a many2many relationship field (e.g. a customer that has multiple tags)?
+ How can I import a many2many relationship field + (e.g. a customer that has multiple tags)?
-

The tags should be separated by a comma without any spacing. For example, if you want you customer to be lined to both tags 'Manufacturer' and 'Retailer' then you will encode it as follow "Manufacturer,Retailer" in the same column of your CSV file.

+

The tags should be separated by a comma without any + spacing. For example, if you want you customer to be + lined to both tags 'Manufacturer' and 'Retailer' + then you will encode it as follow "Manufacturer, + Retailer" in the same column of your CSV file.

+ CSV file for many2many relationship
- Can I import several times the same record?
+ How can I import a one2many relationship (e.g. several + Order Lines of a Sale Order)?
-

If you import a file that contains one of the column "External ID" or "Database ID", records that have already been imported will be modified instead of being created. This is very usefull as it allows you to import several times the same CSV file while having made some changes in between two imports. OpenERP will take care of creating or modifying each record depending if it's new or not.

This feature allows you to use the Import/Export tool of OpenERP to modify a batch of records in your favorite spreadsheet application.

+

If you want to import sales order having several + order lines; for each order line, you need to reserve + a specific row in the CSV file. The first order line + will be imported on the same row as the information + relative to order. Any additional lines will need an + addtional row that does not have any information in + the fields relative to the order.

+

As an example, here is + purchase.order_functional_error_line_cant_adpat.CSV + file of some quotations you can import, based on demo + data.

+ File of some Quotations +

The following CSV file shows how to import purchase + orders with their respective purchase order lines:

+ Purchase orders with their respective purchase order lines +

The following CSV file shows how to import + suppliers and their respective contacts

+ Suppliers and their respective contacts
+
- What happens if I do not provide a value for a specific field?
+ Can I import several times the same record?
-

If you do not set all fields in your CSV file, OpenERP will assign the default value for every non defined fields. But if you -set fields with empty values in your CSV file, OpenERP will set the EMPTY value in the field, instead of assigning the default value.

+

If you import a file that contains one of the + column "External ID" or "Database ID", records that + have already been imported will be modified instead of + being created. This is very usefull as it allows you + to import several times the same CSV file while having + made some changes in between two imports. OpenERP will + take care of creating or modifying each record + depending if it's new or not.

This feature + allows you to use the Import/Export tool of OpenERP to + modify a batch of records in your favorite spreadsheet + application.

- How to export/import different tables from an SQL application to OpenERP?
+ What happens if I do not provide a value for a + specific field?
-

If you need to import data from different tables, you will have to recreate relations between records belonging to different tables. (e.g. if you import companies and persons, you will have to recreate the link between each person and the company they work for).

+

If you do not set all fields in your CSV file, + OpenERP will assign the default value for every non + defined fields. But if you + set fields with empty values in your CSV file, OpenERP + will set the EMPTY value in the field, instead of + assigning the default value.

- +
+
+ How to export/import different tables from an SQL + application to OpenERP?
+
+

If you need to import data from different tables, + you will have to recreate relations between records + belonging to different tables. (e.g. if you import + companies and persons, you will have to recreate the + link between each person and the company they work + for).

To manage relations between tables, + you can use the "External ID" facilities of OpenERP. + The "External ID" of a record is the unique identifier + of this record in another application. This "External + ID" must be unique accoss all the records of all + objects, so it's a good practice to prefix this + "External ID" with the name of the application or + table. (like 'company_1', 'person_1' instead of '1') +

As an example, suppose you have a SQL database + with two tables you want to import: companies and + persons. Each person belong to one company, so you + will have to recreate the link between a person and + the company he work for. (If you want to test this + example, here is a dump of such a PostgreSQL database) + (file: https://docs.google.com/open?id=0B5BDHVRYo-q5S0FQNEJobjZqQUk).

+

We will first export all companies and their + "External ID". In PSQL, write the following command: +

    copy + (select 'company_'||id as "External ID",company_name + as "Name",'True' as "Is a Company" from companies) TO + '/tmp/company.csv' with CSV HEADER;

+

This SQL command will create the following CSV file: +
    External ID,Name,Is a + Company
     + company_1,Bigees,True
     + company_2,Organi,True
     + company_3,Boum,True

To create the CSV file for + persons, linked to companies, we will use the + following SQL command in PSQL:

+

    copy (select 'person_'||id + as "External ID",person_name as "Name",'False' as "Is + a Company",'company_'||company_id as "Related + Company/External ID" from persons) TO '/tmp/person.csv' + with CSV

+

It will produce the following CSV file:
+     External ID,Name,Is a + Company,Related Company/External ID
+     person_1,Fabien,False,company_1 +
     + person_2,Laurence,False,company_1
+     person_3,Eric,False,company_2 +
     + person_4,Ramsy,False,company_3

+

As you can see in this file, Fabien and Laurence + are working for the Bigees company (company_1) and + Eric is working for the Organi company. The relation + between persons and companies is done using the + External ID of the companies. We had to prefix the + "External ID" by the name of the table to avoid a + conflict of ID between persons and companies (person_1 + and company_1 who shared the same ID 1 in the orignial + database).

+

The two files produced are ready to be imported in + OpenERP without any modifications. After having + imported these two CSV files, you will have 4 contacts + and 3 companies. (the firsts two contacts are linked + to the first company). You must first import the + companies and then the persons.

+
+
-- cgit v1.2.3 From 3a5334672fe17e8926f6a5236dcd4892def8b3be Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Thu, 1 Nov 2012 18:13:15 +0530 Subject: Add a proper file. bzr revid: vba@tinyerp.com-20121101124315-30vw1xc6c4ajp3i5 --- addons/base_import/static/src/xml/import.xml | 2 -- 1 file changed, 2 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index ea9da98f2eb..c149c825ea7 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -168,8 +168,6 @@ you an example for Products and their Categories.

CSV file for categories
CSV file for Products - - -- cgit v1.2.3 From c8a160f251bb44f7aff8ea86a2fc7226be13aa31 Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Fri, 2 Nov 2012 11:37:10 +0530 Subject: [IMP]Improve content. bzr revid: vba@tinyerp.com-20121102060710-x5p5yl39n5qpe7ii --- addons/base_import/static/src/xml/import.xml | 46 +++++++++++++--------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index c149c825ea7..1a0a731a466 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -185,7 +185,7 @@ 'Sellable' category found in the Product Category list ("Misc. Products/Sellable"). We recommend you modify one of the duplicates' values or your product category - hierarchy. + hierarchy.
However if you do not wish to change your configuration of product categories, we recommend you use make use of the external ID for this field @@ -203,7 +203,8 @@ lined to both tags 'Manufacturer' and 'Retailer' then you will encode it as follow "Manufacturer, Retailer" in the same column of your CSV file.

- CSV file for many2many relationship
+ + CSV file for Manufacturer, Retailer
@@ -223,7 +224,7 @@ purchase.order_functional_error_line_cant_adpat.CSV file of some quotations you can import, based on demo data.

- File of some Quotations + File for some Quotations

The following CSV file shows how to import purchase orders with their respective purchase order lines:

Purchase orders with their respective purchase order lines @@ -298,27 +299,24 @@ as "Name",'True' as "Is a Company" from companies) TO '/tmp/company.csv' with CSV HEADER;

This SQL command will create the following CSV file: -
    External ID,Name,Is a - Company
     - company_1,Bigees,True
     - company_2,Organi,True
     - company_3,Boum,True

To create the CSV file for - persons, linked to companies, we will use the - following SQL command in PSQL:

-

    copy (select 'person_'||id - as "External ID",person_name as "Name",'False' as "Is - a Company",'company_'||company_id as "Related - Company/External ID" from persons) TO '/tmp/person.csv' - with CSV

-

It will produce the following CSV file:
-     External ID,Name,Is a - Company,Related Company/External ID
-     person_1,Fabien,False,company_1 -
     - person_2,Laurence,False,company_1
-     person_3,Eric,False,company_2 -
     - person_4,Ramsy,False,company_3

+
    External ID,Name,Is a Company +
    company_1,Bigees,True +
    company_2,Organi,True +
    company_3,Boum,True

+

To create the CSV file for persons, linked to + companies, we will use the following SQL command in + PSQL:

    copy (select + 'person_'||id as "External ID",person_name as + "Name",'False' as "Is a Company",'company_'||company_id + as "Related Company/External ID" from persons) TO + '/tmp/person.csv' with CSV

+

It will produce the following CSV file: +
    External ID,Name,Is a + Company,Related Company/External ID +
    person_1,Fabien,False,company_1 +
    person_2,Laurence,False,company_1 +
    person_3,Eric,False,company_2 +
    person_4,Ramsy,False,company_3

As you can see in this file, Fabien and Laurence are working for the Bigees company (company_1) and Eric is working for the Organi company. The relation -- cgit v1.2.3 From e0bd5017e91e1d48eb8a03492f0699499c86650d Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Fri, 2 Nov 2012 12:03:50 +0530 Subject: Add a sql file and their link. bzr revid: vba@tinyerp.com-20121102063350-ce4q6cq38n84jz70 --- addons/base_import/static/src/xml/import.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/base_import/static/src/xml') diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index 1a0a731a466..8388b739a2f 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -290,8 +290,8 @@ persons. Each person belong to one company, so you will have to recreate the link between a person and the company he work for. (If you want to test this - example, here is a dump of such a PostgreSQL database) - (file: https://docs.google.com/open?id=0B5BDHVRYo-q5S0FQNEJobjZqQUk).

+ example, here is a + dump of such a PostgreSQL database).

We will first export all companies and their "External ID". In PSQL, write the following command:

    copy -- cgit v1.2.3