Modification history Groups and Users

413 Note: Foreground table Each of these types is described in relation to a foreground table – the table whose entry form you are viewing and whose entries would be updated by a simple CSV file. Just because one of these relation fields appears on the foreground table, does not mean that there is an inverse field on the related table – but there may be. So there is no one-to-many field in the User form to reflect the many-to-one user_id Salesman field in the Customer form, but there is a many-to-one partner_id Partner Name field in the Addresses form to reflect the one-to-many child_ids Partner Contacts field in the Customer form. Have a look at the screenshots below to see the differences. Figure 27.15: A many-to-one field: a salesperson linked to a partner Figure 27.16: A many-to-many field: partner categories Figure 27.17: A one-to-many field: partner contacts All of the other fields are coded in the CSV file as just one text string in each column. Many-to-one fields Many-to-one fields represent a relationship between the foreground table and another table in the database where the foreground table has a single entry for the other table. Open ERP tries to link the new record in the foreground table with the field in the other table by matching the field values. Tip: Field identifiers If you are working on the server side you can use identifiers rather than the names of resources to link tables. To do this you import the first file for example, Products with a column named id in your CSV file that contains a unique identifier for each product. This could be an incrementing number. When you import other files which link to the first table, you can use the identifier in preference to the names so, for example, when you are saving inventory you can use product:id instead of the product name. You then do not need any complex conversion to create links between the two tables. This considerably simplifies the importation of another database into Open ERP. You just create a linking id column for each table that you are importing that contains the identifier used in the first table.