Access rights for menus

410 Tip: Python Expressions Using the Expression button you can enter expressions in the Python language. These expressions can use all of the object’s fields for their calculations. For example if you make a report on an order you can use the following expression: ‘.2f ’ amount_total 0.9, In this example, amount_total is a field from the order object. The result will be 90 of the total of the order, formatted to two decimal places. You can check the result in Open ERP using the menu Purchases → Purchase Management → Requests for Quotation . Creating a new report The general template is made up of loops such as the list of selected orders and fields from the object, which can also be looped. Format them to your requirements then save the template. The existing report templates make up a rich source of examples. You can start by adding the loops and several fields to create a minimal template. When the report has been created, send it to the server by clicking OpenERP Report Designer → Send to the server , which brings up the Send To Server dialog box. A Technical Name for the report is assigned by default, to make it appear beside the other sales order reports. Rename the template as Sale Order New in Report Name , check the checkbox Corporate Header and finally click Send Report to Server. To send it to the server, you can specify if you prefer Open ERP to produce a PDF when the user prints the document, or if Open ERP should open the document for editing in OpenOffice.org Writer before printing. To do that choose PDF , OpenOffice SXW or HTML in the field Select Rpt. Type.

27.7.3 Creating common headers for reports

When saving new reports and reports that you have modified, you are given the option to select a header. This header is a template that creates a standard page header and footer containing data that is defined in each database. This template can be customized by changing the company information through the menu Administration → Companies → Companies. You may select your parent company from the list and edit the fields Report Header, Report Footer 1, Report Footer 2 in the General Information tab. If your company has a logo that you would want to appear in all reports, you may add it using the Logo field. You can also change the appearance of the headerfooter by editing the XML code in the tabs HeaderFooter and Internal HeaderFooter. For any kind of troubleshooting problems kindly mail us at cdetinyerp.com .

27.8 Importing and exporting data

Every form in Open ERP has a standard mechanism for importing data from a CSV file through the client user interface. That is the same format as used in the language translations. Note: Forms and Lists You have access to the Import and Export functions in the web client on a single form view in read- only mode – you cannot reach Import or Export in any other view or when the form is editable. If you are using the GTK client you can find the functions from the top menu Form → Import data... and Form → Export data.... The CSV file format is a text format compatible with most spreadsheet programs such as OpenOffice Calc and Microsoft Excel and is easily editable as a worksheet. The first line contains the name of the field in the form. All the subsequent lines are data, aligned in their respective columns. 411

27.8.1 Exporting Open ERP data to CSV

Start exploring Open ERP’s use of the CSV format by exporting a modestly complex set of data, the partners and partner addresses in the demonstration data. Go to Sales → Address Book → Customers for a list of partners and select the records to export by clicking the checkbox on the left of each record. Then look for the Other Options section on the right of the list and click the Export link. This pops up the Export Data dialog box. Select the following fields: • Name, • Contact Name under the Contacts menu, • City under the Contacts menu. You can either select and add them one at a time, or Ctrl-click them and add the multiple selection - the order in which you select them is the order in which they will be displayed. If you do not wish to export your your data just yet or would like to use the same fields for future exports, you have the option to save these settings. To do that click Save List and give your export a name. Then click Export and save the resulting data.csv file somewhere accessible - perhaps your Desktop. You can open that file in a spreadsheet program or a text editor. You will see that you have a list of partners, with the name and city of each partner’s contacts alongside. In the couple of cases where there is more than one address, the partner name is left out. So it is important to note that the order of entries is critical - do not sort that list Tip: List limits There is a limit to the number of items you can export in the clients - it is the number you can actually see and that is 20 items by default in the web client, but is arbitrary in the GTK client. You can change the number of items viewed by clicking on the link which shows the count of the items. You can then make a selection of limiting it to fixed number of items at a time, for example, 50 or 100, or you can choose to view unlimited number of items at a time.

27.8.2 Importing CSV data to Open ERP

Use this export file as a template for an import file by deleting all of the data and using new data here you will just import new data alongside the demonstration data, but the principle is the same for a blank database. For example, to import partners with several contacts for which you specify a name and a city, you would create the following CSV file from the export file: Table 27.1: Example of importing partner address fields Name ContactsContact Name ContactsCity Whole Globe Technologies Graham Global Athens Wanda World Rome Emerson Earth New York Miles A Minute From the list of partners, click the Import button and then in the Import Data window click Browse to search for and import the new data.csv file. The web client automatically matches column names but the GTK client requires that you click the Auto detect button. You can use the default Options or change them according to preference. Then click Import. You will get a dialog box showing that you have imported 2 objects, and you can see the new partners and partner addresses when you refresh the list on screen.